Mercurial > pidgin
changeset 12573:200f22ca4890
[gaim-migrate @ 14895]
Bring back 'Gaim idle'
This seems to be working for me
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 20 Dec 2005 06:41:56 +0000 |
parents | bf01b160ab0d |
children | a4500bcbec08 |
files | src/gtkprefs.c src/idle.c src/prefs.c |
diffstat | 3 files changed, 36 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkprefs.c Tue Dec 20 02:39:30 2005 +0000 +++ b/src/gtkprefs.c Tue Dec 20 06:41:56 2005 +0000 @@ -1660,7 +1660,20 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - vbox = gaim_gtk_make_frame (ret, _("Away")); + /* Idle stuff */ + vbox = gaim_gtk_make_frame(ret, _("Idle")); + + gaim_gtk_prefs_dropdown(vbox, _("Idle time _reporting:"), + GAIM_PREF_STRING, "/core/away/idle_reporting", + _("None"), "none", + _("Gaim usage"), "gaim", +#ifdef USE_SCREENSAVER + _("Mouse movement"), "system", +#endif + NULL); + + /* Away stuff */ + vbox = gaim_gtk_make_frame(ret, _("Away")); label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), GAIM_PREF_STRING, "/core/away/auto_reply", @@ -1669,10 +1682,9 @@ _("When both away and idle"), "awayidle", NULL); - button = gaim_gtk_prefs_checkbox(_("_Report idle time"), - "/core/away/report_idle", vbox); + /* Auto-away stuff */ + vbox = gaim_gtk_make_frame(ret, _("Auto-away")); - vbox = gaim_gtk_make_frame (ret, _("Auto-away")); button = gaim_gtk_prefs_checkbox(_("Change status when _idle"), "/core/away/away_when_idle", vbox); @@ -1696,15 +1708,6 @@ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), menu); - /* - * TODO: Need to allow users to choose a GaimSavedStatus - * to use when going idle-away. Or figure out a - * better UI for this. Set the preference - * "/core/savedstatus/idleaway" to the name of the - * GaimSavedStatus to use. - * - */ - if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); @@ -1889,7 +1892,6 @@ } void gaim_gtk_prefs_update_old() { - const char *tmp; /* Rename some old prefs */ gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); @@ -1906,13 +1908,8 @@ gaim_prefs_rename_boolean_toggle("/gaim/gtk/conversations/ignore_formatting", "/gaim/gtk/conversations/show_incoming_formatting"); - /* this string pref turned into a boolean, try to be friendly */ - if (gaim_prefs_exists("/gaim/gtk/idle/reporting_method")) - { - tmp = gaim_prefs_get_string("/gaim/gtk/idle/reporting_method"); - if (tmp != NULL && !strcmp(tmp, "none")) - gaim_prefs_set_bool("/core/away/report_idle", FALSE); - } + /* this string pref moved into the core, try to be friendly */ + gaim_prefs_rename("/gaim/gtk/idle/reporting_method", "/core/away/idle_reporting"); /* Remove some no-longer-used prefs */ gaim_prefs_remove("/gaim/gtk/blist/auto_expand_contacts");
--- a/src/idle.c Tue Dec 20 02:39:30 2005 +0000 +++ b/src/idle.c Tue Dec 20 06:41:56 2005 +0000 @@ -176,16 +176,31 @@ { time_t time_idle; gboolean auto_away; + const gchar *idle_reporting; gboolean report_idle; GList *l; gaim_signal_emit(gaim_blist_get_handle(), "update-idle"); - if (idle_ui_ops != NULL && idle_ui_ops->get_time_idle != NULL) + idle_reporting = gaim_prefs_get_string("/core/away/idle_reporting"); + report_idle = TRUE; + if (!strcmp(idle_reporting, "system") && + (idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL)) + { + /* Use system idle time (mouse or keyboard movement, etc.) */ time_idle = idle_ui_ops->get_time_idle(); - else + } + else if (!strcmp(idle_reporting, "gaim")) + { /* Use 'Gaim idle' */ time_idle = time(NULL) - last_active_time; + } + else + { + /* Don't report idle time */ + time_idle = 0; + report_idle = FALSE; + } /* Auto-away stuff */ auto_away = gaim_prefs_get_bool("/core/away/away_when_idle"); @@ -202,7 +217,6 @@ } /* Idle reporting stuff */ - report_idle = gaim_prefs_get_bool("/core/away/report_idle"); if (report_idle && (time_idle >= IDLEMARK) && !have_set_idle) { for (l = gaim_connections_get_all(); l != NULL; l = l->next)
--- a/src/prefs.c Tue Dec 20 02:39:30 2005 +0000 +++ b/src/prefs.c Tue Dec 20 06:41:56 2005 +0000 @@ -1097,7 +1097,7 @@ /* Away */ gaim_prefs_add_none("/core/away"); - gaim_prefs_add_bool("/core/away/report_idle", TRUE); + gaim_prefs_add_string("/core/away/idle_reporting", "system"); gaim_prefs_add_bool("/core/away/away_when_idle", TRUE); gaim_prefs_add_int("/core/away/mins_before_away", 5);