From: Jim Evins Date: Tue, 28 Oct 2003 00:53:02 +0000 (+0000) Subject: Much cleaner implementation of fix for Bug #822848. X-Git-Tag: glabels-2_3_0~560 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b657e02ae4905a080de7ca849c5b5310e50b2b91;p=glabels Much cleaner implementation of fix for Bug #822848. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@330 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/ui.c b/glabels2/src/ui.c index 0900d653..acb3332f 100644 --- a/glabels2/src/ui.c +++ b/glabels2/src/ui.c @@ -333,12 +333,29 @@ gl_ui_init (BonoboUIComponent *ui_component, g_signal_connect (G_OBJECT (recent_view), "activate", G_CALLBACK (gl_file_open_recent), win); - /* Hack: squirrel away a copy to be unreferenced in gl_window_destroy() */ + /* Squirrel away a copy to be unreferenced in gl_ui_unref() */ g_object_set_data (G_OBJECT (ui_component), "recent-view", recent_view); gl_debug (DEBUG_UI, "END"); } +/*****************************************************************************/ +/* Unref wrapper. */ +/*****************************************************************************/ +void +gl_ui_unref (BonoboUIComponent *ui_component) +{ + EggRecentView *recent_view; + + /* Pull out recent view to unreference. */ + recent_view = g_object_get_data (G_OBJECT(ui_component), "recent-view"); + if (recent_view) { + g_object_unref (recent_view); + } + + bonobo_object_unref(ui_component); +} + /*****************************************************************************/ /* Update all verbs of given UI component. */ /*****************************************************************************/ diff --git a/glabels2/src/ui.h b/glabels2/src/ui.h index 51d0f452..3d326e94 100644 --- a/glabels2/src/ui.h +++ b/glabels2/src/ui.h @@ -35,6 +35,8 @@ void gl_ui_init (BonoboUIComponent *ui_component, GtkWidget *cursor_info_frame, GtkWidget *zoom_info_frame); +void gl_ui_unref (BonoboUIComponent *ui_component); + void gl_ui_update_all (BonoboUIComponent *ui_component, glView *view); diff --git a/glabels2/src/window.c b/glabels2/src/window.c index 347b4d08..21cbedb3 100644 --- a/glabels2/src/window.c +++ b/glabels2/src/window.c @@ -22,7 +22,6 @@ #include -#include "recent-files/egg-recent-view.h" #include "ui.h" #include "window.h" #include "util.h" @@ -216,15 +215,7 @@ gl_window_destroy (GtkObject *gtk_object) window_list = g_list_remove (window_list, window); if (window->uic) { - EggRecentView *recent_view; - - /* Hack: pull out recent view to unreference. */ - recent_view = g_object_get_data (G_OBJECT(window->uic), "recent-view"); - if (recent_view) { - g_object_unref (recent_view); - } - - bonobo_object_unref(window->uic); + gl_ui_unref(window->uic); window->uic = NULL; }