summaryrefslogtreecommitdiffstats
path: root/gtk/src/main.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-06-20 15:58:36 +0000
committerjstebbins <[email protected]>2011-06-20 15:58:36 +0000
commit5c75564427bbb893c4444af1d8c7304ce5343dcf (patch)
treed615017f668919154355ed469f0b6a8205b106a4 /gtk/src/main.c
parent2625067e6983ff27d139352178662926020d37d3 (diff)
LinGui: Add status tray icon support for Ubuntu 11.04
Ubuntu disables GtkStatusIcon support in Unity and instead uses a new API called AppIndicator. So this adds support for appindicator when it is detected by configure. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4067 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/main.c')
-rw-r--r--gtk/src/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 2534dc449..6ff84ae89 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -47,6 +47,10 @@
#define pipe(phandles) _pipe (phandles, 4096, _O_BINARY)
#endif
+#if defined(_USE_APP_IND)
+#include <libappindicator/app-indicator.h>
+#endif
+
#include <glib/gstdio.h>
#include <gio/gio.h>
#include "hb.h"
@@ -944,6 +948,22 @@ main (int argc, char *argv[])
#else
gtk_status_icon_set_tooltip(si, "HandBrake");
#endif
+#if defined(_USE_APP_IND)
+ GtkUIManager * uim = GHB_OBJECT(ud->builder, "uimanager1");
+
+ GtkMenu *ai_menu = gtk_ui_manager_get_widget (uim, "/ui/tray_menu");
+ ud->ai = app_indicator_new("HandBrake", "hb-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
+ app_indicator_set_menu( ud->ai, ai_menu );
+ app_indicator_set_label( ud->ai, "", "99.99%");
+ if (ghb_settings_get_boolean(ud->settings, "show_status"))
+ {
+ app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_ACTIVE );
+ }
+ else
+ {
+ app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_PASSIVE );
+ }
+#endif
// Ugly hack to keep subtitle table from bouncing around as I change
// which set of controls are visible