diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 16 | ||||
-rw-r--r-- | src/application-service-appstore.c | 6 | ||||
-rw-r--r-- | src/indicator-application.c | 26 | ||||
-rw-r--r-- | src/libappindicator/app-indicator-enum-types.gen.c.in (renamed from src/libappindicator/app-indicator-enum-types.c.in) | 0 | ||||
-rw-r--r-- | src/libappindicator/app-indicator.c | 20 |
5 files changed, 51 insertions, 17 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 38e6dd9..efae713 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -63,9 +63,21 @@ pkgconfig_DATA = libappindicator/appindicator-0.1.pc pkgconfigdir = $(libdir)/pkgconfig glib_enum_h = libappindicator/app-indicator-enum-types.h -glib_enum_c = libappindicator/app-indicator-enum-types.c +glib_enum_c = libappindicator/app-indicator-enum-types.gen.c glib_enum_headers = $(libappindicator_headers) +libappindicator/app-indicator-enum-types.c: libappindicator/app-indicator-enum-types.gen.c + sed -e "s|\"passive\"|\"Passive\"|" \ + -e "s|\"active\"|\"Active\"|" \ + -e "s|\"attention\"|\"NeedsAttention\"|" \ + -e "s|\"application-status\"|\"ApplicationStatus\"|" \ + -e "s|\"communications\"|\"Communications\"|" \ + -e "s|\"system-services\"|\"SystemServices\"|" \ + -e "s|\"hardware\"|\"Hardware\"|" \ + -e "s|\"other\"|\"Other\"|" \ + $< > $@ +DISTCLEANFILES += libappindicator/app-indicator-enum-types.c + lib_LTLIBRARIES = \ libappindicator.la @@ -80,7 +92,7 @@ libappindicatorinclude_HEADERS = \ libappindicator_la_SOURCES = \ $(libappindicator_headers) \ - $(glib_enum_c) \ + libappindicator/app-indicator-enum-types.c \ notification-watcher-client.h \ notification-item-server.h \ libappindicator/app-indicator.c diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 5b0cc15..70fab18 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -55,9 +55,9 @@ struct _ApplicationServiceAppstorePrivate { AppLruFile * lrufile; }; -#define APP_STATUS_PASSIVE_STR "passive" -#define APP_STATUS_ACTIVE_STR "active" -#define APP_STATUS_ATTENTION_STR "attention" +#define APP_STATUS_PASSIVE_STR "Passive" +#define APP_STATUS_ACTIVE_STR "Active" +#define APP_STATUS_ATTENTION_STR "NeedsAttention" typedef enum _ApplicationStatus ApplicationStatus; enum _ApplicationStatus { diff --git a/src/indicator-application.c b/src/indicator-application.c index 3ef5688..6c053a9 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -41,6 +41,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "application-service-client.h" #include "application-service-marshal.h" +#define PANEL_ICON_SUFFIX "panel" + #define INDICATOR_APPLICATION_TYPE (indicator_application_get_type ()) #define INDICATOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_APPLICATION_TYPE, IndicatorApplication)) #define INDICATOR_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_APPLICATION_TYPE, IndicatorApplicationClass)) @@ -325,7 +327,17 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co theme_dir_ref(application, icon_path); } - app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); + /* We make a long name using the suffix, and if that + icon is available we want to use it. Otherwise we'll + just use the name we were given. */ + gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(longname, GTK_ICON_SIZE_MENU)); + } else { + app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU)); + } + g_free(longname); + app->entry.label = NULL; app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); @@ -390,7 +402,17 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn return; } - gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU); + /* We make a long name using the suffix, and if that + icon is available we want to use it. Otherwise we'll + just use the name we were given. */ + gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + if (gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), longname)) { + gtk_image_set_from_icon_name(app->entry.image, longname, GTK_ICON_SIZE_MENU); + } else { + gtk_image_set_from_icon_name(app->entry.image, iconname, GTK_ICON_SIZE_MENU); + } + g_free(longname); + return; } diff --git a/src/libappindicator/app-indicator-enum-types.c.in b/src/libappindicator/app-indicator-enum-types.gen.c.in index 449f3fc..449f3fc 100644 --- a/src/libappindicator/app-indicator-enum-types.c.in +++ b/src/libappindicator/app-indicator-enum-types.gen.c.in diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index b0f721e..908684f 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -977,7 +977,7 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) } static void -activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data) +activate_menuitem (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) { GtkWidget *widget = (GtkWidget *)user_data; @@ -987,9 +987,9 @@ activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data) static void widget_toggled (GtkWidget *widget, DbusmenuMenuitem *mi) { - dbusmenu_menuitem_property_set (mi, - DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED, - gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); + dbusmenu_menuitem_property_set_int (mi, + DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, + gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); } static void @@ -1014,7 +1014,7 @@ update_icon_name (DbusmenuMenuitem *menuitem, return; dbusmenu_menuitem_property_set (menuitem, - DBUSMENU_MENUITEM_PROP_ICON, + DBUSMENU_MENUITEM_PROP_ICON_NAME, image->data.name.icon_name); } @@ -1031,7 +1031,7 @@ update_stock_item (DbusmenuMenuitem *menuitem, gtk_stock_lookup (image->data.stock.stock_id, &stock); dbusmenu_menuitem_property_set (menuitem, - DBUSMENU_MENUITEM_PROP_ICON, + DBUSMENU_MENUITEM_PROP_ICON_NAME, image->data.stock.stock_id); if (stock.label != NULL) @@ -1074,7 +1074,7 @@ widget_notify_cb (GtkWidget *widget, if (pspec->name == g_intern_static_string ("sensitive")) { dbusmenu_menuitem_property_set_bool (child, - DBUSMENU_MENUITEM_PROP_SENSITIVE, + DBUSMENU_MENUITEM_PROP_ENABLED, GTK_WIDGET_IS_SENSITIVE (widget)); } else if (pspec->name == g_intern_static_string ("label")) @@ -1121,9 +1121,9 @@ container_iterate (GtkWidget *widget, label_set = TRUE; - dbusmenu_menuitem_property_set (child, - DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED, - gtk_check_menu_item_get_active (check) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); + dbusmenu_menuitem_property_set_int (child, + DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, + gtk_check_menu_item_get_active (check) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); g_signal_connect (widget, "toggled", |