[Glade-devel] [patch, glade3] small cleanup
- From: pborelli katamail com (paolo borelli)
- Subject: [Glade-devel] [patch, glade3] small cleanup
- Date: 18 Apr 2003 16:42:06 +0200
--=-7A3fxcRsS2c5WiWRa53U
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2003-04-18 at 12:31, paolo borelli wrote:
Hi!
This patch is a small cleanup: it gets rid of two unused functions:
- glade_util_hide_window_on_delete: it's not used anywhere, we always
use glade_util_hide_window into a callback because we also do other
things like updating menu entries.
- glade_editor_create: it's not used anywhere, the only point in which
it could be used is in glade-project-window, but we open code it. I
think it's a remnant of when the editor was a window instead of a
widget.
ciao
paolo
After sending that out I noticed that glade_util_hide_window uses
gtk_widget_set_uposition, which is deprecated. Here is an updated patch
that also changes the implementation of glade_util_hide_window.
If it looks fine to you, please commit this patch instead of the
previous one. The patch is diffed against latest cvs.
By the way, I think there are other functions which are not used, do you
want me to go through the sources to find them and post a patch? Maybe
some of those are not used yet but useful, but others are only leftovers
and can be removed.
ciao
paolo
--=-7A3fxcRsS2c5WiWRa53U
Content-Disposition: attachment; filename=rm_unused2.patch
Content-Type: text/x-patch; name=rm_unused2.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit
diff -upr gnome2/glade3/ChangeLog glade3/ChangeLog
--- gnome2/glade3/ChangeLog 2003-04-18 12:37:36.000000000 +0200
+++ glade3/ChangeLog 2003-04-18 16:22:40.000000000 +0200
@@ -1,3 +1,12 @@
+2003-04-18 Paolo Borelli <pborelli katamail com>
+
+ * src/glade-editor.[ch]: remove glade_editor_create().
+ * src/glade-utils.[ch]: remove glade_util_hide_window_on_delete(),
+ reimplemented glade_util_hide_window() so that it does not use
+ deprecated functions; it now returns void.
+ * src/glade-project-window.c: updated the callers.
+ * src/glade-menu-editor.c: updated the callers.
+
2003-04-17 Joaquin Cuenca Abela <e98cuenc yahoo com>
* src/glade-project-window.c: modify the confirmation dialog on quit
diff -upr gnome2/glade3/src/glade-editor.c glade3/src/glade-editor.c
--- gnome2/glade3/src/glade-editor.c 2003-04-17 09:51:55.000000000 +0200
+++ glade3/src/glade-editor.c 2003-04-18 16:16:28.000000000 +0200
@@ -1548,15 +1548,6 @@ glade_editor_select_widget (GladeEditor
gtk_signal_emit (GTK_OBJECT (editor),
glade_editor_signals [SELECT_ITEM], widget);
}
-
-void
-glade_editor_create (GladeProjectWindow *gpw)
-{
- if (gpw->editor == NULL) {
- gpw->editor = GLADE_EDITOR (glade_editor_new ());
- gpw->editor->project_window = gpw;
- }
-}
void glade_editor_add_signal (GladeEditor *editor, guint signal_id,
const char *callback_name)
diff -upr gnome2/glade3/src/glade-editor.h glade3/src/glade-editor.h
--- gnome2/glade3/src/glade-editor.h 2003-03-08 17:23:41.000000000 +0100
+++ glade3/src/glade-editor.h 2003-04-18 16:16:28.000000000 +0200
@@ -183,7 +183,6 @@ typedef enum {
GladeEditor *glade_editor_new (void);
-void glade_editor_create (GladeProjectWindow *gpw);
void glade_editor_select_widget (GladeEditor *editor, GladeWidget *widget);
void glade_editor_add_signal (GladeEditor *editor, guint id_signal, const char *callback_name);
diff -upr gnome2/glade3/src/glade-menu-editor.c glade3/src/glade-menu-editor.c
--- gnome2/glade3/src/glade-menu-editor.c 2003-04-03 18:44:18.000000000 +0200
+++ glade3/src/glade-menu-editor.c 2003-04-18 16:16:28.000000000 +0200
@@ -1599,7 +1599,7 @@ on_keys_dialog_response (GtkWidget * wid
}
}
- glade_util_hide_window (menued->keys_dialog);
+ glade_util_hide_window (GTK_WINDOW (menued->keys_dialog));
}
diff -upr gnome2/glade3/src/glade-project-window.c glade3/src/glade-project-window.c
--- gnome2/glade3/src/glade-project-window.c 2003-04-18 12:37:38.000000000 +0200
+++ glade3/src/glade-project-window.c 2003-04-18 16:16:28.000000000 +0200
@@ -525,7 +525,7 @@ gpw_hide_palette_on_delete (GtkWidget *p
{
GtkWidget *palette_item;
- glade_util_hide_window (GTK_WIDGET (palette));
+ glade_util_hide_window (GTK_WINDOW (palette));
palette_item = gtk_item_factory_get_item (item_factory, "<main>/View/Palette");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (palette_item), FALSE);
@@ -584,7 +584,7 @@ gpw_hide_palette (GladeProjectWindow *gp
g_return_if_fail (gpw != NULL);
- glade_util_hide_window (GTK_WIDGET (gpw->palette_window));
+ glade_util_hide_window (gpw->palette_window);
palette_item = gtk_item_factory_get_item (gpw->item_factory,
"<main>/View/Palette");
@@ -597,7 +597,7 @@ gpw_hide_editor_on_delete (GtkWidget *ed
{
GtkWidget *editor_item;
- glade_util_hide_window (GTK_WIDGET (editor));
+ glade_util_hide_window (GTK_WINDOW (editor));
editor_item = gtk_item_factory_get_item (item_factory, "<main>/View/Property Editor");
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (editor_item), FALSE);
@@ -658,7 +658,7 @@ gpw_hide_editor (GladeProjectWindow *gpw
g_return_if_fail (gpw != NULL);
- glade_util_hide_window (GTK_WIDGET (gpw->editor_window));
+ glade_util_hide_window (gpw->editor_window);
editor_item = gtk_item_factory_get_item (gpw->item_factory,
"<main>/View/Property Editor");
@@ -671,7 +671,7 @@ gpw_hide_widget_tree_on_delete (GtkWidge
{
GtkWidget *widget_tree_item;
- glade_util_hide_window (widget_tree);
+ glade_util_hide_window (GTK_WINDOW (widget_tree));
widget_tree_item = gtk_item_factory_get_item (item_factory,
"<main>/View/Widget Tree");
@@ -729,7 +729,7 @@ gpw_hide_widget_tree (GladeProjectWindow
g_return_if_fail (gpw != NULL);
- glade_util_hide_window (GTK_WIDGET (gpw->widget_tree));
+ glade_util_hide_window (GTK_WINDOW (gpw->widget_tree));
widget_tree_item = gtk_item_factory_get_item (gpw->item_factory,
"<main>/View/Widget Tree");
@@ -756,7 +756,7 @@ gpw_hide_clipboard_view_on_delete (GtkWi
{
GtkWidget *clipboard_item;
- glade_util_hide_window (clipboard_view);
+ glade_util_hide_window (GTK_WINDOW (clipboard_view));
clipboard_item = gtk_item_factory_get_item (item_factory,
"<main>/View/Clipboard");
@@ -813,7 +813,7 @@ gpw_hide_clipboard_view (GladeProjectWin
g_return_if_fail (gpw != NULL);
- glade_util_hide_window (GTK_WIDGET (gpw->clipboard->view));
+ glade_util_hide_window (GTK_WINDOW (gpw->clipboard->view));
clipboard_item = gtk_item_factory_get_item (gpw->item_factory,
"<main>/View/Clipboard");
diff -upr gnome2/glade3/src/glade-project-window.h glade3/src/glade-project-window.h
--- gnome2/glade3/src/glade-project-window.h 2003-04-03 18:44:47.000000000 +0200
+++ glade3/src/glade-project-window.h 2003-04-18 16:16:28.000000000 +0200
@@ -28,7 +28,7 @@ struct _GladeProjectWindow
GtkWidget *widget_tree; /* The widget tree window*/
GtkWindow *palette_window; /* The window that will contain the palette */
GladePalette *palette; /* See glade-palette */
- GtkWindow *editor_window; /* The window that will contain the editor */
+ GtkWindow *editor_window; /* The window that will contain the editor */
GladeEditor *editor; /* See glade-editor */
GladeClipboard *clipboard; /* See glade-clipboard */
GladeProjectView *active_view; /* See glade-project-view */
diff -upr gnome2/glade3/src/glade-utils.c glade3/src/glade-utils.c
--- gnome2/glade3/src/glade-utils.c 2003-04-18 12:37:38.000000000 +0200
+++ glade3/src/glade-utils.c 2003-04-18 16:16:28.000000000 +0200
@@ -264,37 +264,27 @@ glade_util_gtk_combo_find (GtkCombo * co
return NULL;
}
-/* This should be hooked up to the delete_event of windows which you want
- to hide, so that if they are shown again they appear in the same place.
- This stops the window manager asking the user to position the window each
- time it is shown, which is quite annoying. */
-gint
-glade_util_hide_window_on_delete (GtkWidget * widget,
- GdkEvent * event,
- gpointer data)
-{
- glade_util_hide_window (widget);
- return TRUE;
-}
-
-gint
-glade_util_hide_window (GtkWidget *widget)
+/**
+ * glade_util_hide_window:
+ * @window:
+ *
+ * If you use this function to handle the delete_event of a window, when it
+ * will be shown again it will appear in the position where it was before
+ * beeing hidden.
+ **/
+void
+glade_util_hide_window (GtkWindow *window)
{
gint x, y;
- gboolean set_position = FALSE;
- /* remember position of window for when it is used again */
- if (widget->window) {
- gdk_window_get_root_origin (widget->window, &x, &y);
- set_position = TRUE;
- }
+ g_return_if_fail (GTK_IS_WINDOW (window));
- gtk_widget_hide (widget);
+ /* remember position of window for when it is used again */
+ gtk_window_get_position (window, &x, &y);
- if (set_position)
- gtk_widget_set_uposition (widget, x, y);
+ gtk_widget_hide (GTK_WIDGET (window));
- return TRUE;
+ gtk_window_move(window, x, y);
}
gint glade_util_check_key_is_esc (GtkWidget *widget,
@@ -307,7 +297,7 @@ gint glade_util_check_key_is_esc (GtkWid
GladeEscAction action = GPOINTER_TO_INT (data);
if (action == GladeEscCloses) {
- glade_util_hide_window (widget);
+ glade_util_hide_window (GTK_WINDOW (widget));
return TRUE;
}
else if (action == GladeEscDestroys) {
@@ -348,3 +338,4 @@ glade_util_file_selection_new (const gch
return filesel;
}
+
diff -upr gnome2/glade3/src/glade-utils.h glade3/src/glade-utils.h
--- gnome2/glade3/src/glade-utils.h 2003-04-03 18:44:55.000000000 +0200
+++ glade3/src/glade-utils.h 2003-04-18 16:16:28.000000000 +0200
@@ -26,9 +26,7 @@ void glade_util_flash_message (guint
any '_' characters. It isn't particularly efficient. */
gint glade_util_compare_stock_labels (gconstpointer a, gconstpointer b);
-gpointer glade_util_gtk_combo_find (GtkCombo *combo);
-gint glade_util_hide_window_on_delete (GtkWidget *widget, GdkEvent *event, gpointer data);
-gint glade_util_hide_window (GtkWidget *widget);
+void glade_util_hide_window (GtkWindow *window);
gint glade_util_check_key_is_esc (GtkWidget *widget, GdkEventKey *event, gpointer data);
gchar *glade_util_gtk_combo_func (gpointer data);
gpointer glade_util_gtk_combo_find (GtkCombo *combo);
--=-7A3fxcRsS2c5WiWRa53U--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]