| 59 #include "gtkimhtmltoolbar.h" |
59 #include "gtkimhtmltoolbar.h" |
| 60 #include "pidginstock.h" |
60 #include "pidginstock.h" |
| 61 #include "gtkthemes.h" |
61 #include "gtkthemes.h" |
| 62 #include "gtkutils.h" |
62 #include "gtkutils.h" |
| 63 |
63 |
| 64 #define PIDGIN_TOPLEVEL_REFFED_FLAG "pidgin-toplevel-is-weakly-reffed" |
|
| 65 |
|
| 66 typedef struct { |
64 typedef struct { |
| 67 GtkWidget *menu; |
65 GtkWidget *menu; |
| 68 gint default_item; |
66 gint default_item; |
| 69 } AopMenu; |
67 } AopMenu; |
| 70 |
68 |
| 71 static guint accels_save_timer = 0; |
69 static guint accels_save_timer = 0; |
| 72 |
|
| 73 static GtkWindow *toplevel = NULL; |
|
| 74 |
|
| 75 static void |
|
| 76 toplevel_weak_notify(gpointer null, GtkWindow *window) |
|
| 77 { |
|
| 78 if (toplevel == window) |
|
| 79 toplevel = NULL; |
|
| 80 } |
|
| 81 |
|
| 82 void |
|
| 83 pidgin_set_toplevel(GtkWindow *new_toplevel) |
|
| 84 { |
|
| 85 /* If new_toplevel is not NULL, then it better be a GtkWindow */ |
|
| 86 g_return_if_fail(!(new_toplevel && !GTK_IS_WINDOW(new_toplevel))); |
|
| 87 |
|
| 88 if (toplevel) { |
|
| 89 g_object_weak_unref(G_OBJECT(toplevel), (GWeakNotify)toplevel_weak_notify, NULL); |
|
| 90 toplevel = NULL; |
|
| 91 } |
|
| 92 |
|
| 93 if (new_toplevel) { |
|
| 94 g_object_weak_ref(G_OBJECT(new_toplevel), (GWeakNotify)toplevel_weak_notify, NULL); |
|
| 95 toplevel = new_toplevel; |
|
| 96 } |
|
| 97 } |
|
| 98 |
|
| 99 GtkWindow * |
|
| 100 pidgin_get_toplevel() |
|
| 101 { |
|
| 102 return toplevel; |
|
| 103 } |
|
| 104 |
70 |
| 105 static gboolean |
71 static gboolean |
| 106 url_clicked_idle_cb(gpointer data) |
72 url_clicked_idle_cb(gpointer data) |
| 107 { |
73 { |
| 108 purple_notify_uri(NULL, data); |
74 purple_notify_uri(NULL, data); |