diff options
author | jstebbins <[email protected]> | 2009-06-17 22:19:26 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-06-17 22:19:26 +0000 |
commit | 2bbee7dc6b7236d75057c194dc12f9aafcd48334 (patch) | |
tree | 1a8a5fdde172ab41c146979e304511540f9fa8f9 /gtk | |
parent | 57952a58b0596d86d6c43d6663590a0c654264c6 (diff) |
LinGui: make the status icon in the system tray a bit more useful
Succumbing to the pleading of users...
- Use HB icon for status
- Add tooltip to status icon that shows progress
- Add preference option to skip the taskbar. So clikcing on the
status icon un-minimizes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2565 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 42 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 22 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 2 | ||||
-rw-r--r-- | gtk/src/main.c | 9 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 5 |
5 files changed, 70 insertions, 10 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index aa44aef28..a727e5975 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -2231,6 +2231,32 @@ ghb_backend_events(signal_user_data_t *ud) } G_MODULE_EXPORT gboolean +status_icon_query_tooltip_cb( + GtkStatusIcon *si, + gint x, + gint y, + gboolean kbd_mode, + GtkTooltip *tt, + signal_user_data_t *ud) +{ + ghb_status_t status; + gchar *status_str; + + ghb_get_status(&status); + if (status.queue.state & GHB_STATE_WORKING) + status_str = working_status_string(ud, &status.queue); + else if (status.queue.state & GHB_STATE_WORKDONE) + status_str = g_strdup("Encode Complete"); + else + status_str = g_strdup("HandBrake"); + + gtk_tooltip_set_text(tt, status_str); + gtk_tooltip_set_icon_from_icon_name(tt, "hb-icon", GTK_ICON_SIZE_BUTTON); + g_free(status_str); + return TRUE; +} + +G_MODULE_EXPORT gboolean ghb_timer_cb(gpointer data) { signal_user_data_t *ud = (signal_user_data_t*)data; @@ -2792,6 +2818,21 @@ pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void +skip_taskbar_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + g_debug("pref_changed_cb"); + ghb_widget_to_setting (ud->settings, widget); + ghb_check_dependency(ud, widget); + const gchar *name = gtk_widget_get_name(widget); + ghb_pref_save(ud->settings, name); + + GtkWindow *window; + window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window")); + gtk_window_set_skip_taskbar_hint(window, + ghb_settings_get_boolean(ud->settings, "skip_taskbar")); +} + +G_MODULE_EXPORT void vqual_granularity_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { g_debug("vqual_granularity_changed_cb"); @@ -3686,7 +3727,6 @@ ghb_notify_done(signal_user_data_t *ud) GtkStatusIcon *si; si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); - gtk_status_icon_set_from_icon_name(si, "hb-status-empty"); #if !defined(_WIN32) NotifyNotification *notification; diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 5e64ed54b..4f0736015 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -3772,7 +3772,20 @@ location as the movie.</property> <property name="position">8</property> </packing> </child> - + <child> + <object class="GtkCheckButton" id="skip_taskbar"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text">Do not put HandBrake in the system TaskBar when minimized.</property> + <property name="label" translatable="yes">Minimize to System Tray</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="skip_taskbar_cb"/> + </object> + <packing> + <property name="expand">False</property> + <property name="position">9</property> + </packing> + </child> <child> <object class="GtkCheckButton" id="allow_tweaks"> <property name="can_focus">True</property> @@ -3782,7 +3795,7 @@ location as the movie.</property> </object> <packing> <property name="expand">False</property> - <property name="position">9</property> + <property name="position">10</property> </packing> </child> <child> @@ -3794,7 +3807,7 @@ location as the movie.</property> </object> <packing> <property name="expand">False</property> - <property name="position">10</property> + <property name="position">11</property> </packing> </child> </object> @@ -5743,7 +5756,8 @@ libx264 authors: </child> </object> <object class="GtkStatusIcon" id="hb_status"> - <property name="icon_name">hb-status</property> + <property name="icon_name">hb-icon</property> + <signal handler="status_icon_query_tooltip_cb" name="query-tooltip"/> <signal handler="status_activate_cb" name="activate"/> </object> <object class="GtkDialog" id="update_dialog"> diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index 9bb7651a6..c68874dc2 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -103,6 +103,8 @@ <dict> <key>EncodeLogLocation</key> <false /> + <key>skip_taskbar</key> + <false /> <key>allow_tweaks</key> <false /> <key>title_no_in_destination</key> diff --git a/gtk/src/main.c b/gtk/src/main.c index 0b3eb09a5..4a684848c 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -790,6 +790,15 @@ main (int argc, char *argv[]) // Add dvd devices to File menu g_idle_add((GSourceFunc)ghb_file_menu_add_dvd, ud); + GtkStatusIcon *si; + si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); + gtk_status_icon_set_has_tooltip(si, TRUE); + + GtkWindow *window; + window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window")); + gtk_window_set_skip_taskbar_hint(window, + ghb_settings_get_boolean(ud->settings, "skip_taskbar")); + // Everything should be go-to-go. Lets rock! gtk_main (); diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index d4bb5cece..4dc683df3 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -658,11 +658,6 @@ queue_add(signal_user_data_t *ud) return FALSE; } - GtkStatusIcon *si; - - si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); - gtk_status_icon_set_from_icon_name(si, "hb-status"); - if (ud->queue == NULL) ud->queue = ghb_array_value_new(32); // Make a copy of current settings to be used for the new job |