gedit r6379 - in trunk: . gedit gedit/dialogs plugins/spell plugins/time
- From: pborelli svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6379 - in trunk: . gedit gedit/dialogs plugins/spell plugins/time
- Date: Sun, 10 Aug 2008 16:40:21 +0000 (UTC)
Author: pborelli
Date: Sun Aug 10 16:40:21 2008
New Revision: 6379
URL: http://svn.gnome.org/viewvc/gedit?rev=6379&view=rev
Log:
2008-08-10 Paolo Borelli <pborelli katamail com>
* plugins/spell/gedit-spell-checker-dialog.c:
* plugins/spell/gedit-spell-language-dialog.c:
* plugins/time/gedit-time-plugin.c:
* gedit/gedit-tab.c:
* gedit/gedit-utils.c:
* gedit/dialogs/gedit-open-location-dialog.c:
* gedit/dialogs/gedit-encodings-dialog.c:
* gedit/dialogs/gedit-preferences-dialog.c:
* gedit/dialogs/gedit-style-scheme-dialog.c:
* gedit/dialogs/gedit-search-dialog.c:
Fix refcounting of objects obtained from gtkbuilder
Modified:
trunk/ChangeLog
trunk/gedit/dialogs/gedit-encodings-dialog.c
trunk/gedit/dialogs/gedit-open-location-dialog.c
trunk/gedit/dialogs/gedit-preferences-dialog.c
trunk/gedit/dialogs/gedit-search-dialog.c
trunk/gedit/dialogs/gedit-style-scheme-dialog.c
trunk/gedit/gedit-commands-file.c
trunk/gedit/gedit-tab.c
trunk/gedit/gedit-utils.c
trunk/plugins/spell/gedit-spell-checker-dialog.c
trunk/plugins/spell/gedit-spell-language-dialog.c
trunk/plugins/time/gedit-time-plugin.c
Modified: trunk/gedit/dialogs/gedit-encodings-dialog.c
==============================================================================
--- trunk/gedit/dialogs/gedit-encodings-dialog.c (original)
+++ trunk/gedit/dialogs/gedit-encodings-dialog.c Sun Aug 10 16:40:21 2008
@@ -357,6 +357,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
content, TRUE, TRUE, 0);
+ g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
g_signal_connect (dlg->priv->add_button,
Modified: trunk/gedit/dialogs/gedit-open-location-dialog.c
==============================================================================
--- trunk/gedit/dialogs/gedit-open-location-dialog.c (original)
+++ trunk/gedit/dialogs/gedit-open-location-dialog.c Sun Aug 10 16:40:21 2008
@@ -208,6 +208,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
content, FALSE, FALSE, 0);
+ g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
}
Modified: trunk/gedit/dialogs/gedit-preferences-dialog.c
==============================================================================
--- trunk/gedit/dialogs/gedit-preferences-dialog.c (original)
+++ trunk/gedit/dialogs/gedit-preferences-dialog.c Sun Aug 10 16:40:21 2008
@@ -1148,7 +1148,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
dlg->priv->notebook, FALSE, FALSE, 0);
-
+ g_object_unref (dlg->priv->notebook);
gtk_container_set_border_width (GTK_CONTAINER (dlg->priv->notebook), 5);
setup_editor_page (dlg);
Modified: trunk/gedit/dialogs/gedit-search-dialog.c
==============================================================================
--- trunk/gedit/dialogs/gedit-search-dialog.c (original)
+++ trunk/gedit/dialogs/gedit-search-dialog.c Sun Aug 10 16:40:21 2008
@@ -438,7 +438,8 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
content, FALSE, FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (content), 5);
+ g_object_unref (content);
+ gtk_container_set_border_width (GTK_CONTAINER (content), 5);
g_signal_connect (dlg->priv->search_text_entry,
"insert_text",
Modified: trunk/gedit/dialogs/gedit-style-scheme-dialog.c
==============================================================================
--- trunk/gedit/dialogs/gedit-style-scheme-dialog.c (original)
+++ trunk/gedit/dialogs/gedit-style-scheme-dialog.c Sun Aug 10 16:40:21 2008
@@ -188,6 +188,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
main_vbox,
FALSE, FALSE, 0);
+ g_objet_unref (main_vbox);
}
static void
Modified: trunk/gedit/gedit-commands-file.c
==============================================================================
--- trunk/gedit/gedit-commands-file.c (original)
+++ trunk/gedit/gedit-commands-file.c Sun Aug 10 16:40:21 2008
@@ -510,8 +510,8 @@
GeditWindow *window)
{
GFile *location;
- GSList *uris = NULL;
const GeditEncoding *encoding;
+ GSList *uris = NULL;
gedit_debug (DEBUG_COMMANDS);
@@ -525,17 +525,25 @@
location = gedit_open_location_dialog_get_location (dlg);
encoding = gedit_open_location_dialog_get_encoding (dlg);
- uris = g_slist_prepend (uris, g_file_get_uri (location));
+ if (location != NULL)
+ {
+ uris = g_slist_prepend (uris, g_file_get_uri (location));
+
+ g_object_unref (location);
+ }
gtk_widget_destroy (GTK_WIDGET (dlg));
- gedit_commands_load_uris (window,
- uris,
- encoding,
- 0);
+ if (uris != NULL)
+ {
+ gedit_commands_load_uris (window,
+ uris,
+ encoding,
+ 0);
- g_slist_foreach (uris, (GFunc) g_free, NULL);
- g_slist_free (uris);
+ g_slist_foreach (uris, (GFunc) g_free, NULL);
+ g_slist_free (uris);
+ }
}
void
Modified: trunk/gedit/gedit-tab.c
==============================================================================
--- trunk/gedit/gedit-tab.c (original)
+++ trunk/gedit/gedit-tab.c Sun Aug 10 16:40:21 2008
@@ -1911,7 +1911,9 @@
location = gedit_document_get_location (doc);
pixbuf = get_icon (theme, location, icon_size);
- g_object_unref (location);
+
+ if (location)
+ g_object_unref (location);
}
}
Modified: trunk/gedit/gedit-utils.c
==============================================================================
--- trunk/gedit/gedit-utils.c (original)
+++ trunk/gedit/gedit-utils.c Sun Aug 10 16:40:21 2008
@@ -1069,7 +1069,7 @@
gtk_builder_add_from_file (builder,
filename,
&error);
-
+
if (error != NULL)
{
*error_widget = handle_builder_error (_("Unable to open ui file %s. Error: %s"),
@@ -1077,18 +1077,18 @@
error->message);
g_error_free (error);
g_free (filename_markup);
-
+
return FALSE;
}
-
+
va_start (args, object_name);
for (name = object_name; name; name = va_arg (args, const gchar *) )
{
GObject **gobj;
-
+
gobj = va_arg (args, GObject **);
*gobj = gtk_builder_get_object (builder, name);
-
+
if (!*gobj)
{
*error_widget = handle_builder_error (_("Unable to find the object '%s' inside file %s."),
@@ -1097,8 +1097,21 @@
ret = FALSE;
break;
}
-
- g_object_ref (*gobj);
+
+ /* we return a new ref for the root objects,
+ * the others are already reffed by their parent root object */
+ if (root_objects != NULL)
+ {
+ gint i;
+
+ for (i = 0; root_objects[i] != NULL; ++i)
+ {
+ if ((strcmp (name, root_objects[i]) == 0))
+ {
+ g_object_ref (*gobj);
+ }
+ }
+ }
}
va_end (args);
Modified: trunk/plugins/spell/gedit-spell-checker-dialog.c
==============================================================================
--- trunk/plugins/spell/gedit-spell-checker-dialog.c (original)
+++ trunk/plugins/spell/gedit-spell-checker-dialog.c Sun Aug 10 16:40:21 2008
@@ -273,6 +273,7 @@
gtk_label_set_label (GTK_LABEL (dlg->language_label), "");
gtk_container_add (GTK_CONTAINER (dlg), content);
+ g_object_unref (content);
gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
gtk_window_set_title (GTK_WINDOW (dlg), _("Check Spelling"));
@@ -292,12 +293,11 @@
gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->suggestions_list), column);
gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->suggestions_list),
- COLUMN_SUGGESTIONS);
+ COLUMN_SUGGESTIONS);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->suggestions_list));
- gtk_tree_selection_set_mode (selection,
- GTK_SELECTION_SINGLE);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
/* Set default button */
GTK_WIDGET_SET_FLAGS (dlg->change_button, GTK_CAN_DEFAULT);
@@ -306,28 +306,26 @@
gtk_entry_set_activates_default (GTK_ENTRY (dlg->word_entry), TRUE);
/* Connect signals */
- g_signal_connect (G_OBJECT (dlg->word_entry), "changed",
+ g_signal_connect (dlg->word_entry, "changed",
G_CALLBACK (word_entry_changed_handler), dlg);
- g_signal_connect (G_OBJECT (dlg->close_button), "clicked",
+ g_signal_connect (dlg->close_button, "clicked",
G_CALLBACK (close_button_clicked_handler), dlg);
g_signal_connect (selection, "changed",
G_CALLBACK (suggestions_list_selection_changed_handler),
dlg);
- g_signal_connect (G_OBJECT (dlg->check_word_button), "clicked",
+ g_signal_connect (dlg->check_word_button, "clicked",
G_CALLBACK (check_word_button_clicked_handler), dlg);
- g_signal_connect (G_OBJECT (dlg->add_word_button), "clicked",
+ g_signal_connect (dlg->add_word_button, "clicked",
G_CALLBACK (add_word_button_clicked_handler), dlg);
-
- g_signal_connect (G_OBJECT (dlg->ignore_button), "clicked",
+ g_signal_connect (dlg->ignore_button, "clicked",
G_CALLBACK (ignore_button_clicked_handler), dlg);
- g_signal_connect (G_OBJECT (dlg->ignore_all_button), "clicked",
+ g_signal_connect (dlg->ignore_all_button, "clicked",
G_CALLBACK (ignore_all_button_clicked_handler), dlg);
- g_signal_connect (G_OBJECT (dlg->change_button), "clicked",
+ g_signal_connect (dlg->change_button, "clicked",
G_CALLBACK (change_button_clicked_handler), dlg);
- g_signal_connect (G_OBJECT (dlg->change_all_button), "clicked",
+ g_signal_connect (dlg->change_all_button, "clicked",
G_CALLBACK (change_all_button_clicked_handler), dlg);
-
- g_signal_connect (G_OBJECT (dlg->suggestions_list), "row-activated",
+ g_signal_connect (dlg->suggestions_list, "row-activated",
G_CALLBACK (suggestions_list_row_activated_handler), dlg);
}
Modified: trunk/plugins/spell/gedit-spell-language-dialog.c
==============================================================================
--- trunk/plugins/spell/gedit-spell-language-dialog.c (original)
+++ trunk/plugins/spell/gedit-spell-language-dialog.c Sun Aug 10 16:40:21 2008
@@ -155,7 +155,6 @@
ret = gedit_utils_get_ui_objects (GEDIT_UIDIR "languages-dialog.ui",
root_objects,
&error_widget,
-
"content", &content,
"languages_treeview", &dlg->languages_treeview,
NULL);
@@ -172,7 +171,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox),
content, TRUE, TRUE, 0);
-
+ g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
dlg->model = GTK_TREE_MODEL (gtk_list_store_new (ENCODING_NUM_COLS,
Modified: trunk/plugins/time/gedit-time-plugin.c
==============================================================================
--- trunk/plugins/time/gedit-time-plugin.c (original)
+++ trunk/plugins/time/gedit-time-plugin.c Sun Aug 10 16:40:21 2008
@@ -845,6 +845,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),
content, FALSE, FALSE, 0);
+ g_object_unref (content);
gtk_container_set_border_width (GTK_CONTAINER (content), 5);
gtk_dialog_set_default_response (GTK_DIALOG (dialog->dialog),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]