diff options
author | Ruben Undheim <ruben.undheim@gmail.com> | 2018-09-29 13:54:55 +0200 |
---|---|---|
committer | Ruben Undheim <ruben.undheim@gmail.com> | 2018-09-29 13:54:55 +0200 |
commit | d036addbd8eaec4ef702ddd889bf06e0cb1b3c67 (patch) | |
tree | 856dc2851e9f1e789ed675fcc192f673e5e74273 /src | |
parent | 9e0bd16a997e55d6b9c2e80734ea8e61794c7602 (diff) |
New upstream version 0.84.40+dfsg.1
Diffstat (limited to 'src')
-rw-r--r-- | src/dialogs.c | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/oregano.c | 38 | ||||
-rw-r--r-- | src/sheet/create-wire.h | 2 | ||||
-rw-r--r-- | src/sheet/part-item.c | 24 | ||||
-rw-r--r-- | src/sim-settings-gui.c | 40 |
6 files changed, 45 insertions, 63 deletions
diff --git a/src/dialogs.c b/src/dialogs.c index a18c2df..b2dc908 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -232,7 +232,7 @@ void dialog_about (void) "Bernhard Schuster <bernhard@ahoi.io> (de)", NULL}; - const gchar *copy = _ ("(c) 2017 Guido Trentalancia\n" + const gchar *copy = _ ("(c) 2017-2018 Guido Trentalancia\n" "(c) 2012-2017 Bernhard Schuster\n" "(c) 2009-2012 Marc Lorber\n" "(c) 2003-2006 LUGFi\n" @@ -83,8 +83,6 @@ int main (int argc, char *argv[]) status = g_application_run (G_APPLICATION (app), argc, argv); - oregano_deallocate_memory (); - g_object_unref (app); g_type_class_unref (class); diff --git a/src/oregano.c b/src/oregano.c index fa45777..ecc2ae6 100644 --- a/src/oregano.c +++ b/src/oregano.c @@ -76,7 +76,24 @@ static void oregano_open (GApplication *application, GFile **files, gint n_files static void oregano_finalize (GObject *object) { + GList *iter; + Library *l; + cursors_shutdown (); + + g_object_unref (oregano.settings); + + // Free the memory used by the parts libraries + for (iter = oregano.libraries; iter; iter = iter->next) { + l = (Library *) iter->data; + g_free (l->name); + g_free (l->author); + g_free (l->version); + } + g_list_free_full (oregano.libraries, g_free); + + clipboard_empty (); + G_OBJECT_CLASS (oregano_parent_class)->finalize (object); } @@ -202,23 +219,4 @@ static void oregano_application (GApplication *app, GFile *file) if (oregano.show_splash && splash) oregano_splash_done (splash, _ ("Welcome to Oregano")); -} - -void oregano_deallocate_memory (void) -{ - GList *iter; - Library *l; - - g_object_unref (oregano.settings); - - // Free the memory used by the parts libraries - for (iter = oregano.libraries; iter; iter = iter->next) { - l = (Library *) iter->data; - g_free (l->name); - g_free (l->author); - g_free (l->version); - } - g_list_free_full (oregano.libraries, g_free); - - clipboard_empty (); -} +}
\ No newline at end of file diff --git a/src/sheet/create-wire.h b/src/sheet/create-wire.h index 947a98e..c7df634 100644 --- a/src/sheet/create-wire.h +++ b/src/sheet/create-wire.h @@ -56,7 +56,7 @@ struct _CreateWireInfo }; CreateWireInfo *create_wire_info_new (Sheet *sheet); -void create_wire_destroy (CreateWireInfo *wire_info); +void create_wire_info_destroy (CreateWireInfo *wire_info); gboolean create_wire_setup (Sheet *sheet); gboolean create_wire_orientationtoggle (Sheet *sheet); gboolean create_wire_event (Sheet *sheet, GdkEvent *event, gpointer data); diff --git a/src/sheet/part-item.c b/src/sheet/part-item.c index 90cdd44..172fd2c 100644 --- a/src/sheet/part-item.c +++ b/src/sheet/part-item.c @@ -15,6 +15,7 @@ * Copyright (C) 2003,2006 Ricardo Markiewicz * Copyright (C) 2009-2012 Marc Lorber * Copyright (C) 2013-2014 Bernhard Schuster + * Copyright (C) 2018 Guido Trentalancia * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -373,6 +374,8 @@ static void prop_dialog_response (GtkWidget *dialog, gint response, PartPropDial Part *part; gchar *prop_name; const gchar *prop_value; + guint prop_value_length; + gboolean valid_entry; GtkWidget *w; item = prop_dialog->part_item; @@ -388,8 +391,25 @@ static void prop_dialog_response (GtkWidget *dialog, gint response, PartPropDial for (props = part_get_properties (part); props; props = props->next) { prop = props->data; if (g_ascii_strcasecmp (prop->name, prop_name) == 0) { - g_free (prop->value); - prop->value = g_strdup (prop_value); + valid_entry = TRUE; + + // Prevent invalid properties name entries + if (g_ascii_strcasecmp (prop->name, "Refdes") == 0) { + // Prevent invalid voltage source name entries + if (prop->value[0] == 'V') { + if (prop_value[0] != 'V') + valid_entry = FALSE; + prop_value_length = strlen (prop_value); + for (int i = 1; i < prop_value_length; i++) + if (prop_value[i] < '0' || prop_value[i] > '9') + valid_entry = FALSE; + } + } + + if (valid_entry) { + g_free (prop->value); + prop->value = g_strdup (prop_value); + } } } g_free (prop_name); diff --git a/src/sim-settings-gui.c b/src/sim-settings-gui.c index 75eb6cc..663aa14 100644 --- a/src/sim-settings-gui.c +++ b/src/sim-settings-gui.c @@ -16,7 +16,7 @@ * Copyright (C) 2003,2006 Ricardo Markiewicz * Copyright (C) 2009-2012 Marc Lorber * Copyright (C) 2013-2014 Bernhard Schuster - * Copyright (C) 2017 Guido Trentalancia + * Copyright (C) 2017-2017 Guido Trentalancia * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -423,24 +423,7 @@ static void response_callback (GtkButton *button, SchematicView *sv) s->dc_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_dc_enable)); g_free (s->dc_vin); - s->dc_vin = NULL; - tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_dc_vin)); - if (tmp) { - node_ids = g_strsplit (tmp, "V(", 0); - tmp = g_strdup (node_ids[1]); - g_strfreev (node_ids); - if (tmp) { - node_ids = g_strsplit (tmp, ")", 0); - g_free (tmp); - if (node_ids[0]) - s->dc_vin = g_strdup (node_ids[0]); - else - s->dc_vin = g_strdup(""); - g_strfreev (node_ids); - } - } - if (s->dc_vin == NULL) - s->dc_vin = g_strdup (""); + s->dc_vin = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_dc_vin)); g_free (s->dc_vout); s->dc_vout = NULL; @@ -516,24 +499,7 @@ static void response_callback (GtkButton *button, SchematicView *sv) s->noise_enable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (s_gui->w_noise_enable)); g_free (s->noise_vin); - s->noise_vin = NULL; - tmp = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_noise_vin)); - if (tmp) { - node_ids = g_strsplit (tmp, "V(", 0); - tmp = g_strdup (node_ids[1]); - g_strfreev (node_ids); - if (tmp) { - node_ids = g_strsplit (tmp, ")", 0); - g_free (tmp); - if (node_ids[0]) - s->noise_vin = g_strdup (node_ids[0]); - else - s->noise_vin = g_strdup(""); - g_strfreev (node_ids); - } - } - if (s->noise_vin == NULL) - s->noise_vin = g_strdup(""); + s->noise_vin = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (s_gui->w_noise_vin)); g_free (s->noise_vout); s->noise_vout = NULL; |