From af102f5b5497c155bece1e6d30a5efac06c86d68 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 22 Sep 2010 11:55:45 +0200 Subject: chat-window: most of the functions can be static --- src/empathy-chat-window.c | 86 +++++++++++++++++++++++++++-------------------- src/empathy-chat-window.h | 18 +--------- 2 files changed, 51 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 4b181d3dd..bc50355a5 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -146,6 +146,20 @@ static const GtkTargetEntry drag_types_dest_file[] = { static void chat_window_update (EmpathyChatWindow *window); +static void empathy_chat_window_add_chat (EmpathyChatWindow *window, + EmpathyChat *chat); + +static void empathy_chat_window_remove_chat (EmpathyChatWindow *window, + EmpathyChat *chat); + +static void empathy_chat_window_move_chat (EmpathyChatWindow *old_window, + EmpathyChatWindow *new_window, + EmpathyChat *chat); + +static void empathy_chat_window_get_nb_chats (EmpathyChatWindow *self, + guint *nb_rooms, + guint *nb_private); + G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, G_TYPE_OBJECT); static void @@ -1154,6 +1168,12 @@ chat_window_tabs_right_activate_cb (GtkAction *action, chat_window_menu_context_update (priv, num_pages); } +static EmpathyChatWindow * +empathy_chat_window_new (void) +{ + return EMPATHY_CHAT_WINDOW (g_object_new (EMPATHY_TYPE_CHAT_WINDOW, NULL)); +} + static void chat_window_detach_activate_cb (GtkAction *action, EmpathyChatWindow *window) @@ -1348,6 +1368,21 @@ chat_window_set_highlight_room_tab_label (EmpathyChat *chat) g_free (markup); } +static gboolean +empathy_chat_window_has_focus (EmpathyChatWindow *window) +{ + EmpathyChatWindowPriv *priv; + gboolean has_focus; + + g_return_val_if_fail (EMPATHY_IS_CHAT_WINDOW (window), FALSE); + + priv = GET_PRIV (window); + + g_object_get (priv->dialog, "has-toplevel-focus", &has_focus, NULL); + + return has_focus; +} + static void chat_window_new_message_cb (EmpathyChat *chat, EmpathyMessage *message, @@ -2062,17 +2097,23 @@ empathy_chat_window_init (EmpathyChatWindow *window) window); } -EmpathyChatWindow * -empathy_chat_window_new (void) +static GtkWidget * +empathy_chat_window_get_dialog (EmpathyChatWindow *window) { - return EMPATHY_CHAT_WINDOW (g_object_new (EMPATHY_TYPE_CHAT_WINDOW, NULL)); + EmpathyChatWindowPriv *priv; + + g_return_val_if_fail (window != NULL, NULL); + + priv = GET_PRIV (window); + + return priv->dialog; } /* Returns the window to open a new tab in if there is only one window * visble, otherwise, returns NULL indicating that a new window should * be added. */ -EmpathyChatWindow * +static EmpathyChatWindow * empathy_chat_window_get_default (gboolean room) { GSettings *gsettings = g_settings_new (EMPATHY_PREFS_UI_SCHEMA); @@ -2118,19 +2159,7 @@ empathy_chat_window_get_default (gboolean room) return NULL; } -GtkWidget * -empathy_chat_window_get_dialog (EmpathyChatWindow *window) -{ - EmpathyChatWindowPriv *priv; - - g_return_val_if_fail (window != NULL, NULL); - - priv = GET_PRIV (window); - - return priv->dialog; -} - -void +static void empathy_chat_window_add_chat (EmpathyChatWindow *window, EmpathyChat *chat) { @@ -2199,7 +2228,7 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window, DEBUG ("Chat added (%d references)", G_OBJECT (chat)->ref_count); } -void +static void empathy_chat_window_remove_chat (EmpathyChatWindow *window, EmpathyChat *chat) { @@ -2237,7 +2266,7 @@ empathy_chat_window_remove_chat (EmpathyChatWindow *window, g_object_unref (chat); } -void +static void empathy_chat_window_move_chat (EmpathyChatWindow *old_window, EmpathyChatWindow *new_window, EmpathyChat *chat) @@ -2266,7 +2295,7 @@ empathy_chat_window_move_chat (EmpathyChatWindow *old_window, g_object_unref (chat); } -void +static void empathy_chat_window_switch_to_chat (EmpathyChatWindow *window, EmpathyChat *chat) { @@ -2284,21 +2313,6 @@ empathy_chat_window_switch_to_chat (EmpathyChatWindow *window, page_num); } -gboolean -empathy_chat_window_has_focus (EmpathyChatWindow *window) -{ - EmpathyChatWindowPriv *priv; - gboolean has_focus; - - g_return_val_if_fail (EMPATHY_IS_CHAT_WINDOW (window), FALSE); - - priv = GET_PRIV (window); - - g_object_get (priv->dialog, "has-toplevel-focus", &has_focus, NULL); - - return has_focus; -} - EmpathyChat * empathy_chat_window_find_chat (TpAccount *account, const gchar *id) @@ -2380,7 +2394,7 @@ empathy_chat_window_present_chat (EmpathyChat *chat, gtk_widget_grab_focus (chat->input_text_view); } -void +static void empathy_chat_window_get_nb_chats (EmpathyChatWindow *self, guint *nb_rooms, guint *nb_private) diff --git a/src/empathy-chat-window.h b/src/empathy-chat-window.h index 4cbd2094a..5477479ac 100644 --- a/src/empathy-chat-window.h +++ b/src/empathy-chat-window.h @@ -57,28 +57,12 @@ struct _EmpathyChatWindowClass { }; GType empathy_chat_window_get_type (void); -EmpathyChatWindow *empathy_chat_window_get_default (gboolean room); -EmpathyChatWindow *empathy_chat_window_new (void); -GtkWidget * empathy_chat_window_get_dialog (EmpathyChatWindow *window); -void empathy_chat_window_add_chat (EmpathyChatWindow *window, - EmpathyChat *chat); -void empathy_chat_window_remove_chat (EmpathyChatWindow *window, - EmpathyChat *chat); -void empathy_chat_window_move_chat (EmpathyChatWindow *old_window, - EmpathyChatWindow *new_window, - EmpathyChat *chat); -void empathy_chat_window_switch_to_chat (EmpathyChatWindow *window, - EmpathyChat *chat); -gboolean empathy_chat_window_has_focus (EmpathyChatWindow *window); + EmpathyChat * empathy_chat_window_find_chat (TpAccount *account, const gchar *id); void empathy_chat_window_present_chat (EmpathyChat *chat, gint64 timestamp); -void empathy_chat_window_get_nb_chats (EmpathyChatWindow *window, - guint *nb_rooms, - guint *nb_private); - G_END_DECLS #endif /* __EMPATHY_CHAT_WINDOW_H__ */ -- cgit v1.2.3