diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2007-10-13 19:47:48 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-10-13 19:47:48 +0800 |
commit | 0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad (patch) | |
tree | e3b4078a2ee06cd777a50399771a2fca7263898d | |
parent | b4b1a54e84d210404ebc0f6c3e80622bc277ebc0 (diff) | |
download | gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar.gz gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar.bz2 gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar.lz gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar.xz gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.tar.zst gsoc2013-empathy-0ab84cc3ffe6129ae40ad436eb62fccbd52b00ad.zip |
Use g_timeout_add_seconds when appropriated to avoid weaking the process
2007-10-13 Xavier Claessens <xclaesse@gmail.com>
* libempathy-gtk/empathy-main-window.c:
* libempathy-gtk/empathy-presence-chooser.c:
* libempathy-gtk/empathy-contact-list-view.c:
* libempathy-gtk/empathy-contact-widget.c:
* libempathy-gtk/empathy-chat.c:
* libempathy-gtk/empathy-contact-list-store.c:
* libempathy-gtk/empathy-chat-window.c:
* libempathy/empathy-idle.c:
* tests/contact-manager.c: Use g_timeout_add_seconds when appropriated
to avoid weaking the process too much.
svn path=/trunk/; revision=370
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat-window.c | 55 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-list-store.c | 20 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 10 | ||||
-rw-r--r-- | libempathy-gtk/empathy-main-window.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-presence-chooser.c | 6 | ||||
-rw-r--r-- | libempathy/empathy-idle.c | 6 | ||||
-rw-r--r-- | tests/contact-manager.c | 2 |
10 files changed, 47 insertions, 78 deletions
@@ -1,3 +1,16 @@ +2007-10-13 Xavier Claessens <xclaesse@gmail.com> + + * libempathy-gtk/empathy-main-window.c: + * libempathy-gtk/empathy-presence-chooser.c: + * libempathy-gtk/empathy-contact-list-view.c: + * libempathy-gtk/empathy-contact-widget.c: + * libempathy-gtk/empathy-chat.c: + * libempathy-gtk/empathy-contact-list-store.c: + * libempathy-gtk/empathy-chat-window.c: + * libempathy/empathy-idle.c: + * tests/contact-manager.c: Use g_timeout_add_seconds when appropriated + to avoid weaking the process too much. + 2007-10-11 Xavier Claessens <xclaesse@gmail.com> * libempathy/empathy-tp-contact-list.c: Set supress_handler to TRUE when diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c index 6535500de..54e896263 100644 --- a/libempathy-gtk/empathy-chat-window.c +++ b/libempathy-gtk/empathy-chat-window.c @@ -60,8 +60,6 @@ #define DEBUG_DOMAIN "ChatWindow" -#define URGENCY_TIMEOUT 60*1000 - struct _EmpathyChatWindowPriv { EmpathyChatroomManager *chatroom_manager; GList *chats; @@ -73,8 +71,6 @@ struct _EmpathyChatWindowPriv { gboolean page_added; gboolean dnd_same_window; - guint urgency_timeout_id; - GtkWidget *dialog; GtkWidget *notebook; @@ -510,10 +506,6 @@ empathy_chat_window_finalize (GObject *object) g_source_remove (priv->save_geometry_id); } - if (priv->urgency_timeout_id != 0) { - g_source_remove (priv->urgency_timeout_id); - } - chat_windows = g_list_remove (chat_windows, window); gtk_widget_destroy (priv->dialog); g_object_unref (priv->tooltips); @@ -954,9 +946,9 @@ chat_window_configure_event_cb (GtkWidget *widget, } priv->save_geometry_id = - g_timeout_add (500, - (GSourceFunc) chat_window_save_geometry_timeout_cb, - window); + g_timeout_add_seconds (1, + (GSourceFunc) chat_window_save_geometry_timeout_cb, + window); return FALSE; } @@ -1690,21 +1682,6 @@ chat_window_drag_data_received (GtkWidget *widget, } } -static gboolean -chat_window_urgency_timeout_func (EmpathyChatWindow *window) -{ - EmpathyChatWindowPriv *priv; - - priv = GET_PRIV (window); - - empathy_debug (DEBUG_DOMAIN, "Turning off urgency hint"); - gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), FALSE); - - priv->urgency_timeout_id = 0; - - return FALSE; -} - static void chat_window_set_urgency_hint (EmpathyChatWindow *window, gboolean urgent) @@ -1713,29 +1690,9 @@ chat_window_set_urgency_hint (EmpathyChatWindow *window, priv = GET_PRIV (window); - if (!urgent) { - /* Remove any existing hint and timeout. */ - if (priv->urgency_timeout_id) { - empathy_debug (DEBUG_DOMAIN, "Turning off urgency hint"); - gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), FALSE); - g_source_remove (priv->urgency_timeout_id); - priv->urgency_timeout_id = 0; - } - return; - } - - /* Add a new hint and renew any exising timeout or add a new one. */ - if (priv->urgency_timeout_id) { - g_source_remove (priv->urgency_timeout_id); - } else { - empathy_debug (DEBUG_DOMAIN, "Turning on urgency hint"); - gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), TRUE); - } - - priv->urgency_timeout_id = g_timeout_add ( - URGENCY_TIMEOUT, - (GSourceFunc) chat_window_urgency_timeout_func, - window); + empathy_debug (DEBUG_DOMAIN, "Turning %s urgency hint", + urgent ? "on" : "off"); + gtk_window_set_urgency_hint (GTK_WINDOW (priv->dialog), urgent); } EmpathyChatWindow * diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index c98cc12df..f68a82826 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1029,8 +1029,8 @@ chat_composing_start (EmpathyChat *chat) TP_CHANNEL_CHAT_STATE_COMPOSING); } - priv->composing_stop_timeout_id = g_timeout_add ( - 1000 * COMPOSING_STOP_TIMEOUT, + priv->composing_stop_timeout_id = g_timeout_add_seconds ( + COMPOSING_STOP_TIMEOUT, (GSourceFunc) chat_composing_stop_timeout_cb, chat); } diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index 6ca5c60a1..8638ce12e 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -43,11 +43,11 @@ * (e.g. online, offline or from normal to a busy state). */ -/* Time user is shown as active */ -#define ACTIVE_USER_SHOW_TIME 7000 +/* Time in seconds user is shown as active */ +#define ACTIVE_USER_SHOW_TIME 7 -/* Time after connecting which we wait before active users are enabled */ -#define ACTIVE_USER_WAIT_TO_ENABLE_TIME 5000 +/* Time in seconds after connecting which we wait before active users are enabled */ +#define ACTIVE_USER_WAIT_TO_ENABLE_TIME 5 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT_LIST_STORE, EmpathyContactListStorePriv)) @@ -220,9 +220,9 @@ empathy_contact_list_store_init (EmpathyContactListStore *store) priv = GET_PRIV (store); priv->show_avatars = TRUE; - priv->inhibit_active = g_timeout_add (ACTIVE_USER_WAIT_TO_ENABLE_TIME, - (GSourceFunc) contact_list_store_inibit_active_cb, - store); + priv->inhibit_active = g_timeout_add_seconds (ACTIVE_USER_WAIT_TO_ENABLE_TIME, + (GSourceFunc) contact_list_store_inibit_active_cb, + store); } static void @@ -984,9 +984,9 @@ contact_list_store_contact_update (EmpathyContactListStore *store, if (do_set_active) { data = contact_list_store_contact_active_new (store, contact, do_remove); - g_timeout_add (ACTIVE_USER_SHOW_TIME, - (GSourceFunc) contact_list_store_contact_active_cb, - data); + g_timeout_add_seconds (ACTIVE_USER_SHOW_TIME, + (GSourceFunc) contact_list_store_contact_active_cb, + data); } } diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index e3816dda7..a30298e3a 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -891,8 +891,7 @@ contact_list_view_drag_motion (GtkWidget *widget, dm->view = EMPATHY_CONTACT_LIST_VIEW (widget); dm->path = gtk_tree_path_copy (path); - dm->timeout_id = g_timeout_add ( - 1500, + dm->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) contact_list_view_drag_motion_cb, dm); } diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index afd434f3f..34a8023fe 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -42,8 +42,8 @@ #include "empathy-avatar-image.h" #include "empathy-ui-utils.h" -/* Delay before updating the widget when the id entry changed (ms) */ -#define ID_CHANGED_TIMEOUT 500 +/* Delay before updating the widget when the id entry changed (seconds) */ +#define ID_CHANGED_TIMEOUT 1 typedef struct { EmpathyContactFactory *factory; @@ -329,9 +329,9 @@ contact_widget_id_changed_cb (GtkEntry *entry, } self->widget_id_timeout = - g_timeout_add (ID_CHANGED_TIMEOUT, - (GSourceFunc) contact_widget_id_activate_timeout, - self); + g_timeout_add_seconds (ID_CHANGED_TIMEOUT, + (GSourceFunc) contact_widget_id_activate_timeout, + self); } static void diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c index 7543c456e..8883fa306 100644 --- a/libempathy-gtk/empathy-main-window.c +++ b/libempathy-gtk/empathy-main-window.c @@ -868,9 +868,9 @@ main_window_configure_event_cb (GtkWidget *widget, g_source_remove (window->size_timeout_id); } - window->size_timeout_id = g_timeout_add (500, - (GSourceFunc) main_window_configure_event_timeout_cb, - window); + window->size_timeout_id = g_timeout_add_seconds (1, + (GSourceFunc) main_window_configure_event_timeout_cb, + window); return FALSE; } diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index f3097abce..53993eaa3 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -367,9 +367,9 @@ presence_chooser_scroll_event_cb (EmpathyPresenceChooser *chooser, priv->scroll_state = sas->state; priv->scroll_timeout_id = - g_timeout_add (500, - (GSourceFunc) presence_chooser_scroll_timeout_cb, - chooser); + g_timeout_add_seconds (1, + (GSourceFunc) presence_chooser_scroll_timeout_cb, + chooser); presence_chooser_flash_stop (chooser, sas->state); gtk_label_set_text (GTK_LABEL (priv->label), sas->status); diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 87389277c..77e7c1ffa 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -607,9 +607,9 @@ idle_ext_away_start (EmpathyIdle *idle) priv = GET_PRIV (idle); idle_ext_away_stop (idle); - priv->ext_away_timeout = g_timeout_add (EXT_AWAY_TIME * 1000, - (GSourceFunc) idle_ext_away_cb, - idle); + priv->ext_away_timeout = g_timeout_add_seconds (EXT_AWAY_TIME, + (GSourceFunc) idle_ext_away_cb, + idle); } static void diff --git a/tests/contact-manager.c b/tests/contact-manager.c index a8831a971..75bfc7fae 100644 --- a/tests/contact-manager.c +++ b/tests/contact-manager.c @@ -22,7 +22,7 @@ main (int argc, char **argv) main_loop = g_main_loop_new (NULL, FALSE); manager = empathy_contact_manager_new (); - g_timeout_add (5000, time_out, main_loop); + g_timeout_add_seconds (5, time_out, main_loop); g_main_loop_run (main_loop); |