aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-22 20:34:07 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-22 20:59:07 +0800
commit0e6298a2a650970c32706c6e6b703417b747b7fd (patch)
tree394bf5593ee7927ef9e27e84fc509bcb266ed9ff
parent6d577ec2bc68b365aa0b02235d8b1d8d1aac297c (diff)
downloadgsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar.gz
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar.bz2
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar.lz
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar.xz
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.tar.zst
gsoc2013-empathy-0e6298a2a650970c32706c6e6b703417b747b7fd.zip
move the static variable used by the singleton out of empathy_log_window_show
That's useful for other functions which would like to check if there is still a window or not.
-rw-r--r--libempathy-gtk/empathy-log-window.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 04abd0102..31f1ca283 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -142,6 +142,8 @@ enum {
COL_CHAT_COUNT
};
+static EmpathyLogWindow *log_window = NULL;
+
static void
account_manager_prepared_cb (GObject *source_object,
GAsyncResult *result,
@@ -187,26 +189,28 @@ empathy_log_window_show (TpAccount *account,
gboolean is_chatroom,
GtkWindow *parent)
{
- static EmpathyLogWindow *window = NULL;
EmpathyAccountChooser *account_chooser;
TpAccountManager *account_manager;
GtkBuilder *gui;
gchar *filename;
+ EmpathyLogWindow *window;
- if (window) {
- gtk_window_present (GTK_WINDOW (window->window));
+ if (log_window) {
+ gtk_window_present (GTK_WINDOW (log_window->window));
if (account && chat_id) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), 1);
- log_window_chats_set_selected (window, account,
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (log_window->notebook), 1);
+ log_window_chats_set_selected (log_window, account,
chat_id, is_chatroom);
}
- return window->window;
+ return log_window->window;
}
- window = g_new0 (EmpathyLogWindow, 1);
- window->log_manager = tpl_log_manager_dup_singleton ();
+ log_window = g_new0 (EmpathyLogWindow, 1);
+ log_window->log_manager = tpl_log_manager_dup_singleton ();
+
+ window = log_window;
filename = empathy_file_lookup ("empathy-log-window.ui",
"libempathy-gtk");
@@ -241,7 +245,7 @@ empathy_log_window_show (TpAccount *account,
g_object_unref (gui);
g_object_add_weak_pointer (G_OBJECT (window->window),
- (gpointer) &window);
+ (gpointer) &log_window);
/* We set this up here so we can block it when needed. */
g_signal_connect (window->calendar_chats, "day-selected",