]> granicus.if.org Git - handbrake/commitdiff
LinGui: make the status icon in the system tray a bit more useful
authorjstebbins <jstebbins.hb@gmail.com>
Wed, 17 Jun 2009 22:19:26 +0000 (22:19 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Wed, 17 Jun 2009 22:19:26 +0000 (22:19 +0000)
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

gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/internal_defaults.xml
gtk/src/main.c
gtk/src/queuehandler.c

index aa44aef280874cf08a211fe0cfa4eb073f783abf..a727e597564ebfca66dffef26070a2a037efc15b 100644 (file)
@@ -2230,6 +2230,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)
 {
@@ -2791,6 +2817,21 @@ pref_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
        ghb_pref_save(ud->settings, name);
 }
 
+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)
 {
@@ -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;
index 5e64ed54b8237d90ce0f48fe31960e7fcd5d89a3..4f0736015ec451e4f87fffba60407bf8517f35c9 100644 (file)
@@ -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">
index 9bb7651a6788abe6b87ea3f14fd05cab5ab978fa..c68874dc2e0d72cc45ba1c6cbe64f53b72aeb72f 100644 (file)
        <dict>
                <key>EncodeLogLocation</key>
                <false />
+               <key>skip_taskbar</key>
+               <false />
                <key>allow_tweaks</key>
                <false />
                <key>title_no_in_destination</key>
index 0b3eb09a50293122f6b192a0276f4191dbd6c864..4a684848c0b0981e75d0698a3615869a896a9971 100644 (file)
@@ -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 ();
index d4bb5cece2dabc0dcfc199b2e74300f28e7f4cb8..4dc683df351c045b45d320d96a892b02b5acdf43 100644 (file)
@@ -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