From c02292c7020477df40431dbbadfa30e79ed6a79a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 4 Mar 2010 15:14:24 -0600 Subject: Building a new base object for our menuitem --- .bzrignore | 1 + src/Makefile.am | 2 ++ src/app-gtk-menu-item.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ src/app-gtk-menu-item.h | 32 +++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 src/app-gtk-menu-item.c create mode 100644 src/app-gtk-menu-item.h diff --git a/.bzrignore b/.bzrignore index dce3b2e..24932b4 100644 --- a/.bzrignore +++ b/.bzrignore @@ -22,3 +22,4 @@ indicator-messages-service-activate src/messages-service-client.h src/messages-service-server.h po/indicator-messages.pot +src/libmessaging_la-app-gtk-menu-item.lo diff --git a/src/Makefile.am b/src/Makefile.am index 01741d0..7a325c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,6 +8,8 @@ libexec_PROGRAMS = indicator-messages-service messaginglibdir = $(INDICATORDIR) messaginglib_LTLIBRARIES = libmessaging.la libmessaging_la_SOURCES = \ + app-gtk-menu-item.h \ + app-gtk-menu-item.c \ indicator-messages.c \ messages-service-client.h \ dbus-data.h diff --git a/src/app-gtk-menu-item.c b/src/app-gtk-menu-item.c new file mode 100644 index 0000000..9a34f16 --- /dev/null +++ b/src/app-gtk-menu-item.c @@ -0,0 +1,57 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "app-gtk-menu-item.h" + +typedef struct _AppGtkMenuItemPrivate AppGtkMenuItemPrivate; +struct _AppGtkMenuItemPrivate { + int dummy; +}; + +#define APP_GTK_MENU_ITEM_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemPrivate)) + +static void app_gtk_menu_item_class_init (AppGtkMenuItemClass *klass); +static void app_gtk_menu_item_init (AppGtkMenuItem *self); +static void app_gtk_menu_item_dispose (GObject *object); +static void app_gtk_menu_item_finalize (GObject *object); + +G_DEFINE_TYPE (AppGtkMenuItem, app_gtk_menu_item, GTK_TYPE_CHECK_MENU_ITEM); + +static void +app_gtk_menu_item_class_init (AppGtkMenuItemClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + g_type_class_add_private (klass, sizeof (AppGtkMenuItemPrivate)); + + object_class->dispose = app_gtk_menu_item_dispose; + object_class->finalize = app_gtk_menu_item_finalize; + + return; +} + +static void +app_gtk_menu_item_init (AppGtkMenuItem *self) +{ + + return; +} + +static void +app_gtk_menu_item_dispose (GObject *object) +{ + + G_OBJECT_CLASS (app_gtk_menu_item_parent_class)->dispose (object); + return; +} + +static void +app_gtk_menu_item_finalize (GObject *object) +{ + + + G_OBJECT_CLASS (app_gtk_menu_item_parent_class)->finalize (object); + return; +} diff --git a/src/app-gtk-menu-item.h b/src/app-gtk-menu-item.h new file mode 100644 index 0000000..feb3139 --- /dev/null +++ b/src/app-gtk-menu-item.h @@ -0,0 +1,32 @@ +#ifndef __APP_GTK_MENU_ITEM_H__ +#define __APP_GTK_MENU_ITEM_H__ + +#include +#include +#include + +G_BEGIN_DECLS + +#define APP_GTK_MENU_ITEM_TYPE (app_gtk_menu_item_get_type ()) +#define APP_GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItem)) +#define APP_GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemClass)) +#define IS_APP_GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_GTK_MENU_ITEM_TYPE)) +#define IS_APP_GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_GTK_MENU_ITEM_TYPE)) +#define APP_GTK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemClass)) + +typedef struct _AppGtkMenuItem AppGtkMenuItem; +typedef struct _AppGtkMenuItemClass AppGtkMenuItemClass; + +struct _AppGtkMenuItemClass { + GtkCheckMenuItemClass parent_class; +}; + +struct _AppGtkMenuItem { + GtkCheckMenuItem parent; +}; + +GType app_gtk_menu_item_get_type (void); + +G_END_DECLS + +#endif -- cgit v1.2.3 From 49f05b3e7dc4bc807ababdc41c9b039aad261f63 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Mar 2010 10:07:07 -0600 Subject: Switching the attention callback to using a value so it can correctly handle booleans. --- src/im-menu-item.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/im-menu-item.c b/src/im-menu-item.c index ea9190a..5841d81 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -358,7 +358,7 @@ count_cb (IndicateListener * listener, IndicateListenerServer * server, Indicate this indicator should be calling for attention or not. If we are, we need to signal that. */ static void -attention_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data) +attention_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const GValue * propertydata, gpointer data) { g_debug("Got Attention Information"); ImMenuItem * self = IM_MENU_ITEM(data); @@ -373,10 +373,19 @@ attention_cb (IndicateListener * listener, IndicateListenerServer * server, Indi ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(self); gboolean wantit; - if (propertydata == NULL || propertydata[0] == '\0' || !g_strcmp0(propertydata, "false")) { - wantit = FALSE; + if (G_VALUE_HOLDS_BOOLEAN(propertydata)) { + wantit = g_value_get_boolean(propertydata); + } else if (G_VALUE_HOLDS_STRING(propertydata)) { + const gchar * propstring = g_value_get_string(propertydata); + + if (propstring == NULL || propstring[0] == '\0' || !g_strcmp0(propstring, "false")) { + wantit = FALSE; + } else { + wantit = TRUE; + } } else { - wantit = TRUE; + g_warning("Got property '%s' of an unknown type.", property); + return; } if (priv->attention != wantit) { @@ -418,7 +427,7 @@ indicator_modified_cb (IndicateListener * listener, IndicateListenerServer * ser } else if (!g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_COUNT)) { indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, count_cb, self); } else if (!g_strcmp0(property, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION)) { - indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self); + indicate_listener_get_property_value(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self); } else if (!g_strcmp0(property, "sender")) { /* This is a compatibility string with v1 and should be removed */ g_debug("Indicator is using 'sender' property which is a v1 string."); @@ -451,7 +460,7 @@ im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_property_time(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_TIME, time_cb, self); indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ICON, icon_cb, self); indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, count_cb, self); - indicate_listener_get_property(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self); + indicate_listener_get_property_value(listener, server, indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, attention_cb, self); indicate_listener_get_property(listener, server, indicator, "sender", sender_cb, self); g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); -- cgit v1.2.3 From 35402494cbbf708f0bc1a0c3f45e445174cc750d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 13:34:27 -0500 Subject: Grab translation for default name. --- src/launcher-menu-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index f70f28b..279d167 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -167,7 +167,7 @@ launcher_menu_item_new (const gchar * desktop_file) if (default_name == NULL) { dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(self)); } else { - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, default_name); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, _(default_name)); } gchar * iconstr; -- cgit v1.2.3 From 568d4c63169b2c7f42e77ae5b865cc187a83b062 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 22:58:18 -0500 Subject: Putting padding between the items to make them pretty like. --- src/indicator-messages.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 3f533a5..09c2740 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -278,7 +278,10 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_menu_item_new()); - GtkWidget * hbox = gtk_hbox_new(FALSE, 4); + gint padding = 4; + gtk_widget_style_get(GTK_WIDGET(gmi), "horizontal-padding", &padding, NULL); + + GtkWidget * hbox = gtk_hbox_new(FALSE, 0); /* Icon, probably someone's face or avatar on an IM */ mi_data->icon = gtk_image_new(); @@ -309,13 +312,13 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm } } gtk_misc_set_alignment(GTK_MISC(mi_data->icon), 0.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), mi_data->icon, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), mi_data->icon, FALSE, FALSE, padding); gtk_widget_show(mi_data->icon); /* Label, probably a username, chat room or mailbox name */ mi_data->label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_LABEL)); gtk_misc_set_alignment(GTK_MISC(mi_data->label), 0.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, padding); gtk_widget_show(mi_data->label); /* Usually either the time or the count on the individual @@ -323,7 +326,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm mi_data->right = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_RIGHT)); gtk_size_group_add_widget(indicator_right_group, mi_data->right); gtk_misc_set_alignment(GTK_MISC(mi_data->right), 1.0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, padding); gtk_widget_show(mi_data->right); gtk_container_add(GTK_CONTAINER(gmi), hbox); -- cgit v1.2.3 From a9b385e38e95268ac13666b32f114e7651caf776 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 23:01:10 -0500 Subject: Setting the minimum allocation for the image to be the menu icon size even if there isn't any pixmap. --- src/indicator-messages.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 09c2740..70304f4 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -285,13 +285,17 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm /* Icon, probably someone's face or avatar on an IM */ mi_data->icon = gtk_image_new(); + + /* Set the minimum size, we always want it to take space */ + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + gtk_widget_set_size_request(mi_data->icon, width, height); + GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON); if (pixbuf != NULL) { /* If we've got a pixbuf we need to make sure it's of a reasonable size to fit in the menu. If not, rescale it. */ GdkPixbuf * resized_pixbuf; - gint width, height; - gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); if (gdk_pixbuf_get_width(pixbuf) > width || gdk_pixbuf_get_height(pixbuf) > height) { g_debug("Resizing icon from %dx%d to %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), width, height); -- cgit v1.2.3 From 4ec27fb507f927958716bcab10386f969dfee04e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 23:24:34 -0500 Subject: Bumping libindicator version to 0.3.5 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1427bf0..4c40972 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,7 @@ GTK_REQUIRED_VERSION=2.12 GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.3.0 -INDICATOR_REQUIRED_VERSION=0.3.3 +INDICATOR_REQUIRED_VERSION=0.3.5 DBUSMENUGTK_REQUIRED_VERSION=0.2.5 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION -- cgit v1.2.3 From d4ed651dbaa582e9859ace5a5e69a63b2cffbcf6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Mar 2010 23:28:10 -0500 Subject: Switch to using the image helper and drop design team size --- src/indicator-messages.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 3f533a5..110875a 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -31,6 +31,7 @@ with this program. If not, see . #include #include +#include #include "dbus-data.h" #include "messages-service-client.h" @@ -61,8 +62,6 @@ INDICATOR_SET_TYPE(INDICATOR_MESSAGES_TYPE) /* Globals */ static GtkWidget * main_image = NULL; -#define DESIGN_TEAM_SIZE design_team_size -static GtkIconSize design_team_size; static DBusGProxy * icon_proxy = NULL; static GtkSizeGroup * indicator_right_group = NULL; @@ -116,9 +115,9 @@ static void attention_changed_cb (DBusGProxy * proxy, gboolean dot, gpointer userdata) { if (dot) { - gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages-new", DESIGN_TEAM_SIZE); + indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages-new"); } else { - gtk_image_set_from_icon_name(GTK_IMAGE(main_image), "indicator-messages", DESIGN_TEAM_SIZE); + indicator_image_helper_update(GTK_IMAGE(main_image), "indicator-messages"); } return; } @@ -340,9 +339,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm static GtkImage * get_icon (IndicatorObject * io) { - design_team_size = gtk_icon_size_register("design-team-size", 22, 22); - - main_image = gtk_image_new_from_icon_name("indicator-messages", DESIGN_TEAM_SIZE); + main_image = GTK_WIDGET(indicator_image_helper("indicator-messages")); gtk_widget_show(main_image); return GTK_IMAGE(main_image); -- cgit v1.2.3 From bf2af66c70b116d0abd483b82b5a1e43a0dedd5f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 13:28:16 -0500 Subject: 0.3.4 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4c40972..98fc5a5 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.3.3) +AM_INIT_AUTOMAKE(indicator-messages, 0.3.4) AM_MAINTAINER_MODE -- cgit v1.2.3 From b86c59315b25c3a81c03cb2cbf2b63d0e350ffac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 13:44:34 -0500 Subject: debian/control: Updating requirement to libindicator 0.3.5 --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e35bb4a..2a4a684 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ indicator-messages (0.3.4-0ubuntu1~ppa1) UNRELEASED; urgency=low * Fix translation of non-running applications (LP: #540148) * Handling bools for requesting attention from apps * Changing microblogging to broadcast to match Me Menu (LP: #534952) + * debian/control: Updating requirement to libindicator 0.3.5 -- Ted Gould Thu, 18 Mar 2010 13:42:42 -0500 diff --git a/debian/control b/debian/control index 99aff27..10ebc00 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 5.0), intltool, libindicate-dev (>= 0.3.0), libindicate-gtk-dev (>= 0.3.0), - libindicator-dev (>= 0.3.3), + libindicator-dev (>= 0.3.5), libdbusmenu-gtk-dev (>= 0.2.5), libdbusmenu-glib-dev (>= 0.2.5) Standards-Version: 3.8.0 -- cgit v1.2.3 From 6564d7dd105b7ce13dc3d33039206be19ecc2078 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Mar 2010 13:45:22 -0500 Subject: releasing version 0.3.4-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2a4a684..97f43c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-messages (0.3.4-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-messages (0.3.4-0ubuntu1~ppa1) lucid; urgency=low * Upstream release 0.3.4 * Fix avatar spacing to match other menu items @@ -8,7 +8,7 @@ indicator-messages (0.3.4-0ubuntu1~ppa1) UNRELEASED; urgency=low * Changing microblogging to broadcast to match Me Menu (LP: #534952) * debian/control: Updating requirement to libindicator 0.3.5 - -- Ted Gould Thu, 18 Mar 2010 13:42:42 -0500 + -- Ted Gould Thu, 18 Mar 2010 13:45:19 -0500 indicator-messages (0.3.3-0ubuntu2) lucid; urgency=low -- cgit v1.2.3 From 68c5fd531fe031a2e615e84751ac5466d63b1b89 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 15:45:35 -0500 Subject: Replacing the count with the icon --- src/dbus-data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbus-data.h b/src/dbus-data.h index e3d9fd5..c16b2b5 100644 --- a/src/dbus-data.h +++ b/src/dbus-data.h @@ -10,7 +10,7 @@ #define APPLICATION_MENUITEM_TYPE "application-item" #define APPLICATION_MENUITEM_PROP_NAME "app-name" -#define APPLICATION_MENUITEM_PROP_COUNT "app-count" +#define APPLICATION_MENUITEM_PROP_ICON "app-icon" #define INDICATOR_MENUITEM_TYPE "indicator-item" #define INDICATOR_MENUITEM_PROP_LABEL "indicator-label" -- cgit v1.2.3 From 5b178064d69eccc74eb2b7b2dfb505ddc4498957 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:06:02 -0500 Subject: Adds in an application menu item. --- src/indicator-messages.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index f6b2084..2387be4 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -207,6 +207,70 @@ setup_icon_proxy (gpointer userdata) return FALSE; } +/* Sets the label when it changes. */ +static void +application_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, gpointer user_data) +{ + if (!g_strcmp0(prop, APPLICATION_MENUITEM_PROP_NAME)) { + /* Set the main label */ + if (GTK_IS_LABEL(user_data)) { + gtk_label_set_text(GTK_LABEL(user_data), g_value_get_string(value)); + } + } + + return; +} + +/* Builds a menu item representing a running application in the + messaging menu */ +static gboolean +new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +{ + GtkMenuItem * gmi = GTK_MENU_ITEM(gtk_image_menu_item_new()); + + gint padding = 4; + gtk_widget_style_get(GTK_WIDGET(gmi), "horizontal-padding", &padding, NULL); + + GtkWidget * hbox = gtk_hbox_new(FALSE, 0); + + /* Set the minimum size, we always want it to take space */ + gint width, height; + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); + + GtkWidget * icon = gtk_image_new_from_icon_name(dbusmenu_menuitem_property_get(newitem, APPLICATION_MENUITEM_PROP_ICON), GTK_ICON_SIZE_MENU); + gtk_widget_set_size_request(icon, width, height); + gtk_misc_set_alignment(GTK_MISC(icon), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, padding); + gtk_widget_show(icon); + + /* Application name in a label */ + GtkWidget * label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_LABEL)); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, padding); + gtk_widget_show(label); + + /* Insert the hbox */ + gtk_container_add(GTK_CONTAINER(gmi), hbox); + gtk_widget_show(hbox); + + /* Build up the running icon */ + GtkWidget * running_icon = gtk_image_new_from_icon_name("application-running", GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(gmi), running_icon); + gtk_widget_show(running_icon); + + /* Make sure it always appears */ + gtk_image_menu_item_set_always_show_image(GTK_IMAGE_MENU_ITEM(gmi), TRUE); + + /* Attach some of the standard GTK stuff */ + dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent); + + /* Make sure we can handle the label changing */ + g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_prop_change_cb), label); + + return TRUE; +} + + typedef struct _indicator_item_t indicator_item_t; struct _indicator_item_t { GtkWidget * icon; @@ -380,6 +444,7 @@ get_menu (IndicatorObject * io) DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), INDICATOR_MENUITEM_TYPE, new_indicator_item); + dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), APPLICATION_MENUITEM_TYPE, new_application_item); return GTK_MENU(menu); } -- cgit v1.2.3 From 6e0ae1927bd3f61224b9f2d3c43055ecb43a1a2a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:08:48 -0500 Subject: Changing to use the new app type --- src/app-menu-item.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index 7db72bf..a47c073 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -210,6 +210,8 @@ app_menu_item_new (IndicateListener * listener, IndicateListenerServer * server) /* Can not ref as not real GObject */ priv->server = server; + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE); + /* Set up listener signals */ g_signal_connect(G_OBJECT(listener), INDICATE_LISTENER_SIGNAL_SERVER_COUNT_CHANGED, G_CALLBACK(count_changed), self); @@ -244,10 +246,10 @@ update_label (AppMenuItem * self) /* TRANSLATORS: This is the name of the program and the number of indicators. So it would read something like "Mail Client (5)" */ gchar * label = g_strdup_printf(_("%s (%d)"), _(name), priv->unreadcount); - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, label); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), APPLICATION_MENUITEM_PROP_NAME, label); g_free(label); } else { - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, _(name)); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), APPLICATION_MENUITEM_PROP_NAME, _(name)); } return; @@ -318,10 +320,10 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar if (def_icon == NULL) { GIcon * icon = g_app_info_get_icon(priv->appinfo); gchar * iconstr = g_icon_to_string(icon); - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ICON_NAME, iconstr); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), APPLICATION_MENUITEM_PROP_ICON, iconstr); g_free(iconstr); } else { - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ICON_NAME, def_icon); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), APPLICATION_MENUITEM_PROP_ICON, def_icon); } g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE); -- cgit v1.2.3 From b7cc9701efbefc72d168e57d18f13197c1bcee9f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:19:23 -0500 Subject: releasing version 0.3.4-0ubuntu1~ppa2~running1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2d4bc80..0972fa0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-messages (0.3.4-0ubuntu1~ppa2~running1) UNRELEASED; urgency=low +indicator-messages (0.3.4-0ubuntu1~ppa2~running1) lucid; urgency=low * Upstream merge * Show which applications are running with a small icon next to their entry. - -- Ted Gould Tue, 23 Mar 2010 16:12:24 -0500 + -- Ted Gould Tue, 23 Mar 2010 16:18:32 -0500 indicator-messages (0.3.4-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3 From aad1a1cfdf3051929a6788b480c090f7f4e88ef8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:22:26 -0500 Subject: Looking for the right property --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 2387be4..99e303b 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -244,7 +244,7 @@ new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu gtk_widget_show(icon); /* Application name in a label */ - GtkWidget * label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_LABEL)); + GtkWidget * label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, APPLICATION_MENUITEM_PROP_NAME)); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, padding); gtk_widget_show(label); -- cgit v1.2.3 From ae623e9492ce9324b8fb7236b83c681e472328ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:22:57 -0500 Subject: Removing app-gtk-menu-item as it really wasn't needed. --- src/Makefile.am | 2 -- src/app-gtk-menu-item.c | 57 ------------------------------------------------- src/app-gtk-menu-item.h | 32 --------------------------- 3 files changed, 91 deletions(-) delete mode 100644 src/app-gtk-menu-item.c delete mode 100644 src/app-gtk-menu-item.h diff --git a/src/Makefile.am b/src/Makefile.am index 32f0b38..c96ef2d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,8 +8,6 @@ libexec_PROGRAMS = indicator-messages-service messaginglibdir = $(INDICATORDIR) messaginglib_LTLIBRARIES = libmessaging.la libmessaging_la_SOURCES = \ - app-gtk-menu-item.h \ - app-gtk-menu-item.c \ indicator-messages.c \ messages-service-client.h \ dbus-data.h diff --git a/src/app-gtk-menu-item.c b/src/app-gtk-menu-item.c deleted file mode 100644 index 9a34f16..0000000 --- a/src/app-gtk-menu-item.c +++ /dev/null @@ -1,57 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "app-gtk-menu-item.h" - -typedef struct _AppGtkMenuItemPrivate AppGtkMenuItemPrivate; -struct _AppGtkMenuItemPrivate { - int dummy; -}; - -#define APP_GTK_MENU_ITEM_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemPrivate)) - -static void app_gtk_menu_item_class_init (AppGtkMenuItemClass *klass); -static void app_gtk_menu_item_init (AppGtkMenuItem *self); -static void app_gtk_menu_item_dispose (GObject *object); -static void app_gtk_menu_item_finalize (GObject *object); - -G_DEFINE_TYPE (AppGtkMenuItem, app_gtk_menu_item, GTK_TYPE_CHECK_MENU_ITEM); - -static void -app_gtk_menu_item_class_init (AppGtkMenuItemClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (AppGtkMenuItemPrivate)); - - object_class->dispose = app_gtk_menu_item_dispose; - object_class->finalize = app_gtk_menu_item_finalize; - - return; -} - -static void -app_gtk_menu_item_init (AppGtkMenuItem *self) -{ - - return; -} - -static void -app_gtk_menu_item_dispose (GObject *object) -{ - - G_OBJECT_CLASS (app_gtk_menu_item_parent_class)->dispose (object); - return; -} - -static void -app_gtk_menu_item_finalize (GObject *object) -{ - - - G_OBJECT_CLASS (app_gtk_menu_item_parent_class)->finalize (object); - return; -} diff --git a/src/app-gtk-menu-item.h b/src/app-gtk-menu-item.h deleted file mode 100644 index feb3139..0000000 --- a/src/app-gtk-menu-item.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __APP_GTK_MENU_ITEM_H__ -#define __APP_GTK_MENU_ITEM_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -#define APP_GTK_MENU_ITEM_TYPE (app_gtk_menu_item_get_type ()) -#define APP_GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItem)) -#define APP_GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemClass)) -#define IS_APP_GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_GTK_MENU_ITEM_TYPE)) -#define IS_APP_GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_GTK_MENU_ITEM_TYPE)) -#define APP_GTK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_GTK_MENU_ITEM_TYPE, AppGtkMenuItemClass)) - -typedef struct _AppGtkMenuItem AppGtkMenuItem; -typedef struct _AppGtkMenuItemClass AppGtkMenuItemClass; - -struct _AppGtkMenuItemClass { - GtkCheckMenuItemClass parent_class; -}; - -struct _AppGtkMenuItem { - GtkCheckMenuItem parent; -}; - -GType app_gtk_menu_item_get_type (void); - -G_END_DECLS - -#endif -- cgit v1.2.3 From ef62cc12f003eb2acf02ef4904898b965c063212 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Mar 2010 16:35:12 -0500 Subject: releasing version 0.3.4-0ubuntu1~ppa2~running2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0397bdc..5f48a1d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-messages (0.3.4-0ubuntu1~ppa2~running2) UNRELEASED; urgency=low +indicator-messages (0.3.4-0ubuntu1~ppa2~running2) lucid; urgency=low * Upstream merge * Fixing label * Removing unused files - -- Ted Gould Tue, 23 Mar 2010 16:23:20 -0500 + -- Ted Gould Tue, 23 Mar 2010 16:26:16 -0500 indicator-messages (0.3.4-0ubuntu1~ppa2~running1) lucid; urgency=low -- cgit v1.2.3 From e37de87781986e481dfa6b1b8491c7c7d7deb46e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 10:07:27 -0500 Subject: releasing version 0.3.4-0ubuntu1~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 435485a..250fdb0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-messages (0.3.4-0ubuntu1~ppa2) UNRELEASED; urgency=low +indicator-messages (0.3.4-0ubuntu1~ppa2) lucid; urgency=low * Upstream merge * Show which applications are running with a small icon next to their entry. - -- Ted Gould Wed, 24 Mar 2010 10:04:14 -0500 + -- Ted Gould Wed, 24 Mar 2010 10:07:24 -0500 indicator-messages (0.3.4-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3 From 62d8d477bde543062f678c8f8bfddbb6f36104eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 10:30:31 -0500 Subject: debian/changlog: Adding bug number to previous entry. next to their entry. (LP: #438526) --- debian/changelog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 250fdb0..ecce9de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ +indicator-messages (0.3.4-0ubuntu1~ppa3) UNRELEASED; urgency=low + + * debian/changlog: Adding bug number to previous entry. + + -- Ted Gould Wed, 24 Mar 2010 10:29:00 -0500 + indicator-messages (0.3.4-0ubuntu1~ppa2) lucid; urgency=low * Upstream merge * Show which applications are running with a small icon - next to their entry. + next to their entry. (LP: #438526) -- Ted Gould Wed, 24 Mar 2010 10:07:24 -0500 -- cgit v1.2.3 From 28d358c7b459ef636800f253c362819773b91850 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 10:30:42 -0500 Subject: releasing version 0.3.4-0ubuntu1~ppa3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ecce9de..1ac1922 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-messages (0.3.4-0ubuntu1~ppa3) UNRELEASED; urgency=low +indicator-messages (0.3.4-0ubuntu1~ppa3) lucid; urgency=low * debian/changlog: Adding bug number to previous entry. - -- Ted Gould Wed, 24 Mar 2010 10:29:00 -0500 + -- Ted Gould Wed, 24 Mar 2010 10:30:37 -0500 indicator-messages (0.3.4-0ubuntu1~ppa2) lucid; urgency=low -- cgit v1.2.3 From 9bda4f7c7b93d4fa14d926c5382a632871ecb0d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 11:32:06 -0500 Subject: Set the blank icon on proxy objects --- src/app-menu-item.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index a47c073..cbd2242 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -340,6 +340,7 @@ child_added_cb (DbusmenuMenuitem * root, DbusmenuMenuitem * child, guint positio AppMenuItem * self = APP_MENU_ITEM(data); AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self); DbusmenuMenuitemProxy * mip = dbusmenu_menuitem_proxy_new(child); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(mip), DBUSMENU_MENUITEM_PROP_ICON_NAME, DBUSMENU_MENUITEM_ICON_NAME_BLANK); priv->shortcuts = g_list_insert(priv->shortcuts, mip, position); @@ -441,6 +442,7 @@ root_changed (DbusmenuClient * client, DbusmenuMenuitem * newroot, gpointer data g_debug("\tProcessing %d children", g_list_length(children)); while (children != NULL) { DbusmenuMenuitemProxy * mip = dbusmenu_menuitem_proxy_new(DBUSMENU_MENUITEM(children->data)); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(mip), DBUSMENU_MENUITEM_PROP_ICON_NAME, DBUSMENU_MENUITEM_ICON_NAME_BLANK); priv->shortcuts = g_list_append(priv->shortcuts, mip); children = g_list_next(children); } -- cgit v1.2.3 From 2f691859cd3608278bb921248a571ef7c5b77c64 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 11:33:32 -0500 Subject: Making sure command items are using blanks --- src/launcher-menu-item.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 279d167..18f54d8 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -190,6 +190,7 @@ launcher_menu_item_new (const gchar * desktop_file) DbusmenuMenuitem * mi = dbusmenu_menuitem_new(); g_object_set_data(G_OBJECT(mi), NICK_DATA, (gpointer)nicks[i]); + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_ICON_NAME, DBUSMENU_MENUITEM_ICON_NAME_BLANK); dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i])); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self); -- cgit v1.2.3 From ce879d3dedab7c15f7d72640f27458f46b7cf2c2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 17:10:48 -0500 Subject: Allow for applications icons to change incase we haven't gotten the property yet. --- src/indicator-messages.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 99e303b..988d9d6 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -207,6 +207,20 @@ setup_icon_proxy (gpointer userdata) return FALSE; } +/* Sets the icon when it changes. */ +static void +application_icon_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, gpointer user_data) +{ + if (!g_strcmp0(prop, APPLICATION_MENUITEM_PROP_ICON)) { + /* Set the main icon */ + if (GTK_IS_IMAGE(user_data)) { + gtk_image_set_from_icon_name(GTK_IMAGE(user_data), g_value_get_string(value), GTK_ICON_SIZE_MENU); + } + } + + return; +} + /* Sets the label when it changes. */ static void application_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, gpointer user_data) @@ -266,6 +280,7 @@ new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu /* Make sure we can handle the label changing */ g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_prop_change_cb), label); + g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_icon_change_cb), icon); return TRUE; } -- cgit v1.2.3 From 2597b609c3a84e80be1babbb547bac1ccb25f75f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:26:43 -0500 Subject: Making a basic interface for the seen database. --- src/Makefile.am | 2 ++ src/seen-db.c | 25 +++++++++++++++++++++++++ src/seen-db.h | 13 +++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 src/seen-db.c create mode 100644 src/seen-db.h diff --git a/src/Makefile.am b/src/Makefile.am index c96ef2d..7c9842a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,6 +32,8 @@ indicator_messages_service_SOURCES = \ app-menu-item.h \ launcher-menu-item.c \ launcher-menu-item.h \ + seen-db.c \ + seen-db.h \ dirs.h \ dbus-data.h indicator_messages_service_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed -Werror diff --git a/src/seen-db.c b/src/seen-db.c new file mode 100644 index 0000000..dd164f8 --- /dev/null +++ b/src/seen-db.c @@ -0,0 +1,25 @@ +#include "seen-db.h" + +SeenDB * +seen_db_init(void) +{ + GHashTable * hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + return hash; +} + +void +seen_db_add (SeenDB * seendb, const gchar * desktop) +{ + g_hash_table_insert(seendb, + g_strdup(desktop), + GINT_TO_POINTER(TRUE)); + + return; +} + +gboolean +seen_db_seen (SeenDB * seendb, const gchar * desktop) +{ + return GPOINTER_TO_INT(g_hash_table_lookup(seendb, desktop)); +} diff --git a/src/seen-db.h b/src/seen-db.h new file mode 100644 index 0000000..f73c74e --- /dev/null +++ b/src/seen-db.h @@ -0,0 +1,13 @@ + +#ifndef SEEN_DB_H__ +#define SEEN_DB_H__ 1 + +#include + +typedef GHashTable SeenDB; + +SeenDB * seen_db_init(void); +void seen_db_add (SeenDB * seendb, const gchar * desktop); +gboolean seen_db_seen (SeenDB * seendb, const gchar * desktop); + +#endif /* SEEN_DB_H__ */ -- cgit v1.2.3 From 9d667c37212143addd60bb99b6c53c98943a05ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:29:54 -0500 Subject: Changing to be more of a singleton type of thing. Really that makes more sense. --- src/seen-db.c | 15 ++++++++++----- src/seen-db.h | 8 +++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/seen-db.c b/src/seen-db.c index dd164f8..cf2293c 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -1,15 +1,20 @@ #include "seen-db.h" -SeenDB * +GHashTable * seendb = NULL; + +void seen_db_init(void) { - GHashTable * hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + if (seendb != NULL) { + return; + } - return hash; + seendb = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + return; } void -seen_db_add (SeenDB * seendb, const gchar * desktop) +seen_db_add (const gchar * desktop) { g_hash_table_insert(seendb, g_strdup(desktop), @@ -19,7 +24,7 @@ seen_db_add (SeenDB * seendb, const gchar * desktop) } gboolean -seen_db_seen (SeenDB * seendb, const gchar * desktop) +seen_db_seen (const gchar * desktop) { return GPOINTER_TO_INT(g_hash_table_lookup(seendb, desktop)); } diff --git a/src/seen-db.h b/src/seen-db.h index f73c74e..0914e52 100644 --- a/src/seen-db.h +++ b/src/seen-db.h @@ -4,10 +4,8 @@ #include -typedef GHashTable SeenDB; - -SeenDB * seen_db_init(void); -void seen_db_add (SeenDB * seendb, const gchar * desktop); -gboolean seen_db_seen (SeenDB * seendb, const gchar * desktop); +void seen_db_init(void); +void seen_db_add (const gchar * desktop); +gboolean seen_db_seen (const gchar * desktop); #endif /* SEEN_DB_H__ */ -- cgit v1.2.3 From e082f944179d142b643c65004de52f1983698ff9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:33:50 -0500 Subject: Building the seen db on init --- src/messages-service.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/messages-service.c b/src/messages-service.c index 0ebab0b..bc3e9e8 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -39,6 +39,7 @@ with this program. If not, see . #include "dbus-data.h" #include "dirs.h" #include "messages-service-dbus.h" +#include "seen-db.h" static IndicateListener * listener; static GList * serverList = NULL; @@ -1422,6 +1423,8 @@ main (int argc, char ** argv) bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain (GETTEXT_PACKAGE); + seen_db_init(); + dbus_interface = message_service_dbus_new(); listener = indicate_listener_ref_default(); -- cgit v1.2.3 From f4e0f72761eeef5bf7cc250cc55813796c795d64 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:37:28 -0500 Subject: Adding the new server to the seen database. --- src/app-menu-item.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app-menu-item.c b/src/app-menu-item.c index a47c073..cbef924 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -31,6 +31,7 @@ with this program. If not, see . #include "app-menu-item.h" #include "dbus-data.h" #include "default-applications.h" +#include "seen-db.h" enum { COUNT_CHANGED, @@ -309,6 +310,8 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar return; } + seen_db_add(value); + priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(value)); g_return_if_fail(priv->appinfo != NULL); -- cgit v1.2.3 From f4b7762bd69eae3c23b3b76fae07d1ff69965020 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:39:56 -0500 Subject: Checking to see if we've seen the application before choosing whether we have the name or the setup string. --- src/launcher-menu-item.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 279d167..ae14828 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -31,6 +31,7 @@ with this program. If not, see . #include "launcher-menu-item.h" #include "dbus-data.h" #include "default-applications.h" +#include "seen-db.h" enum { NAME_CHANGED, @@ -163,7 +164,14 @@ launcher_menu_item_new (const gchar * desktop_file) app info that we've parsed */ g_debug("\tName: %s", launcher_menu_item_get_name(self)); - const gchar * default_name = get_default_name(desktop_file); + const gchar * default_name = NULL; + + if (seen_db_seen(desktop_file)) { + default_name = get_default_name(desktop_file); + } else { + default_name = get_default_setup(desktop_file); + } + if (default_name == NULL) { dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(self)); } else { -- cgit v1.2.3 From 310a9a4b859ffa85e79f054523e6fd479d87a7c4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:45:48 -0500 Subject: Only build shortcuts if we've been seen before. --- src/launcher-menu-item.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index ae14828..4247738 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -191,17 +191,19 @@ launcher_menu_item_new (const gchar * desktop_file) g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); /* Start to build static shortcuts */ - priv->ids = indicator_desktop_shortcuts_new(priv->desktop, "Messaging Menu"); - const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->ids); - gint i; - for (i = 0; nicks[i] != NULL; i++) { - DbusmenuMenuitem * mi = dbusmenu_menuitem_new(); - g_object_set_data(G_OBJECT(mi), NICK_DATA, (gpointer)nicks[i]); - - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i])); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self); - - priv->shortcuts = g_list_append(priv->shortcuts, mi); + if (seen_db_seen(desktop_file)) { + priv->ids = indicator_desktop_shortcuts_new(priv->desktop, "Messaging Menu"); + const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->ids); + gint i; + for (i = 0; nicks[i] != NULL; i++) { + DbusmenuMenuitem * mi = dbusmenu_menuitem_new(); + g_object_set_data(G_OBJECT(mi), NICK_DATA, (gpointer)nicks[i]); + + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i])); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self); + + priv->shortcuts = g_list_append(priv->shortcuts, mi); + } } /* Check to see if we should be eclipsed */ -- cgit v1.2.3 From b840c918e0a355eabcfff49efc2f4c61803b5c52 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 20:51:43 -0500 Subject: Building a file name and checking if it exists. --- src/seen-db.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index cf2293c..027100d 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -1,6 +1,7 @@ #include "seen-db.h" GHashTable * seendb = NULL; +gchar * filename = NULL; void seen_db_init(void) @@ -10,6 +11,18 @@ seen_db_init(void) } seendb = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + /* Build the filename for the seen database. We're putting + it in the cache directory because it could get deleted and + it really wouldn't be a big deal. */ + if (filename == NULL) { + filename = g_build_filename(g_get_user_cache_dir(), "indicators", "messages", "seen-db.keyfile", NULL); + } + + if (g_file_test(filename, G_FILE_TEST_EXISTS)) { + + } + return; } -- cgit v1.2.3 From 288cb93d92574b947ab5addafcbf58fc7d907670 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:05:07 -0500 Subject: Code to read in the keyfile --- src/seen-db.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index 027100d..7849781 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -1,5 +1,8 @@ #include "seen-db.h" +#define GROUP_NAME "Seen Database" +#define KEY_NAME "DesktopFiles" + GHashTable * seendb = NULL; gchar * filename = NULL; @@ -20,7 +23,35 @@ seen_db_init(void) } if (g_file_test(filename, G_FILE_TEST_EXISTS)) { + GKeyFile * keyfile = g_key_file_new(); + + if (!g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_NONE, NULL)) { + g_key_file_free(keyfile); + keyfile = NULL; + } + + if (keyfile != NULL && !g_key_file_has_key(keyfile, GROUP_NAME, KEY_NAME, NULL)) { + g_warning("Seen DB '%s' does not have key '%s' in group '%s'", filename, KEY_NAME, GROUP_NAME); + g_key_file_free(keyfile); + keyfile = NULL; + } + + if (keyfile != NULL) { + gchar ** desktops = g_key_file_get_string_list(keyfile, GROUP_NAME, KEY_NAME, NULL, NULL); + gint i = 0; + + while (desktops[i] != NULL) { + g_hash_table_insert(seendb, + g_strdup(desktops[i]), + GINT_TO_POINTER(TRUE)); + } + + g_strfreev(desktops); + } + if (keyfile != NULL) { + g_key_file_free(keyfile); + } } return; -- cgit v1.2.3 From af3e958c5a95d419aacdbf6d332935f02a06c57f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:22:49 -0500 Subject: Have a background process for writing out the seen DB --- src/seen-db.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index 7849781..6429c13 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -5,6 +5,7 @@ GHashTable * seendb = NULL; gchar * filename = NULL; +guint write_process = 0; void seen_db_init(void) @@ -57,9 +58,25 @@ seen_db_init(void) return; } +static gboolean +write_seen_db (gpointer user_data) +{ + write_process = 0; + return FALSE; +} + void seen_db_add (const gchar * desktop) { + if (!seen_db_seen(desktop)) { + if (write_process != 0) { + g_source_remove(write_process); + write_process = 0; + } + + write_process = g_timeout_add_seconds(300, write_seen_db, NULL); + } + g_hash_table_insert(seendb, g_strdup(desktop), GINT_TO_POINTER(TRUE)); -- cgit v1.2.3 From 10e6733148b0f561fa0825bc9461d73272a5e6a1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:24:48 -0500 Subject: Some comments --- src/seen-db.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index 6429c13..e09901c 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -7,6 +7,8 @@ GHashTable * seendb = NULL; gchar * filename = NULL; guint write_process = 0; +/* Build the hashtable and then see if we have a keyfile that + we can get the history of desktop files we've seen. */ void seen_db_init(void) { @@ -58,6 +60,8 @@ seen_db_init(void) return; } +/* A function to write out the seen database after it's been + modified for a while. */ static gboolean write_seen_db (gpointer user_data) { @@ -65,6 +69,8 @@ write_seen_db (gpointer user_data) return FALSE; } +/* Add a new desktop file to the seen database. Also sets up a timer + to do the write out. */ void seen_db_add (const gchar * desktop) { @@ -84,6 +90,7 @@ seen_db_add (const gchar * desktop) return; } +/* Checks to see if a desktop file has been seen. */ gboolean seen_db_seen (const gchar * desktop) { -- cgit v1.2.3 From 347750ba909a005d9529c6054f33dbe15fe8fa6c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:26:07 -0500 Subject: Copyright headers. --- src/seen-db.c | 21 +++++++++++++++++++++ src/seen-db.h | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index e09901c..09e67df 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -1,3 +1,24 @@ +/* +A small database of which desktop files we've seen. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + #include "seen-db.h" #define GROUP_NAME "Seen Database" diff --git a/src/seen-db.h b/src/seen-db.h index 0914e52..a998ff0 100644 --- a/src/seen-db.h +++ b/src/seen-db.h @@ -1,3 +1,23 @@ +/* +A small database of which desktop files we've seen. + +Copyright 2010 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ #ifndef SEEN_DB_H__ #define SEEN_DB_H__ 1 -- cgit v1.2.3 From 6e638f602e5765f16b9b7a5f58a5c09f1ffec2ef Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:27:59 -0500 Subject: More comments --- src/seen-db.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/seen-db.c b/src/seen-db.c index 09e67df..4c900be 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -49,17 +49,20 @@ seen_db_init(void) if (g_file_test(filename, G_FILE_TEST_EXISTS)) { GKeyFile * keyfile = g_key_file_new(); + /* Load from file */ if (!g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_NONE, NULL)) { g_key_file_free(keyfile); keyfile = NULL; } + /* Check for keys */ if (keyfile != NULL && !g_key_file_has_key(keyfile, GROUP_NAME, KEY_NAME, NULL)) { g_warning("Seen DB '%s' does not have key '%s' in group '%s'", filename, KEY_NAME, GROUP_NAME); g_key_file_free(keyfile); keyfile = NULL; } + /* Grab them and put in DB */ if (keyfile != NULL) { gchar ** desktops = g_key_file_get_string_list(keyfile, GROUP_NAME, KEY_NAME, NULL, NULL); gint i = 0; @@ -73,6 +76,7 @@ seen_db_init(void) g_strfreev(desktops); } + /* Clean up our file */ if (keyfile != NULL) { g_key_file_free(keyfile); } @@ -95,6 +99,8 @@ write_seen_db (gpointer user_data) void seen_db_add (const gchar * desktop) { + /* If this is a new one, let's set up the timer. If + there's already one clear it. */ if (!seen_db_seen(desktop)) { if (write_process != 0) { g_source_remove(write_process); -- cgit v1.2.3 From a357e73e2fd7154183e499790ad531299e15beec Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 21:57:02 -0500 Subject: Building us a file. --- src/seen-db.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/src/seen-db.c b/src/seen-db.c index 4c900be..0baab5f 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -26,6 +26,7 @@ with this program. If not, see . GHashTable * seendb = NULL; gchar * filename = NULL; +gchar * dirname = NULL; guint write_process = 0; /* Build the hashtable and then see if we have a keyfile that @@ -42,8 +43,11 @@ seen_db_init(void) /* Build the filename for the seen database. We're putting it in the cache directory because it could get deleted and it really wouldn't be a big deal. */ + if (dirname == NULL) { + dirname = g_build_filename(g_get_user_cache_dir(), "indicators", "messages", NULL); + } if (filename == NULL) { - filename = g_build_filename(g_get_user_cache_dir(), "indicators", "messages", "seen-db.keyfile", NULL); + filename = g_build_filename(dirname, "seen-db.keyfile", NULL); } if (g_file_test(filename, G_FILE_TEST_EXISTS)) { @@ -91,6 +95,55 @@ static gboolean write_seen_db (gpointer user_data) { write_process = 0; + + /* Build up the key file */ + GKeyFile * keyfile = g_key_file_new(); + GArray * desktops = g_array_new(FALSE, FALSE, sizeof(gchar *)); + + /* Get the keys from the hashtable and make them + into an array */ + if (keyfile != NULL) { + GList * desktop_keys = g_hash_table_get_keys(seendb); + GList * head = NULL; + + for (head = desktop_keys; head != NULL; head = g_list_next(head)) { + g_array_append_val(desktops, head->data); + } + + g_list_free(desktop_keys); + } + + /* Use the array to dump the strings into the keyfile */ + g_key_file_set_string_list(keyfile, + GROUP_NAME, + KEY_NAME, + (const gchar * const *)desktops->data, + desktops->len); + g_array_free(desktops, TRUE); + + /* Dump the key file to string */ + gchar * keydump = NULL; + gsize keydumplen = 0; + keydump = g_key_file_to_data(keyfile, &keydumplen, NULL); + g_key_file_free(keyfile); + + /* Ensure the directory exists */ + if (g_mkdir_with_parents(dirname, 0700) != 0) { + g_warning("Unable to make directory: %s", dirname); + g_free(keydump); + return FALSE; + } + + /* Dump out the file */ + GError * error = NULL; + if (!g_file_set_contents(filename, keydump, keydumplen, &error)) { + g_warning("Unable to write out file '%s': %s", filename, error->message); + g_error_free(error); + } + + /* Clean up */ + g_free(keydump); + return FALSE; } -- cgit v1.2.3 From 0ba6028b42bd26cf20e7f680b9cc9aca2c3caf19 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 22:02:01 -0500 Subject: Make this easier to test --- src/seen-db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seen-db.c b/src/seen-db.c index 0baab5f..b4df191 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -160,7 +160,7 @@ seen_db_add (const gchar * desktop) write_process = 0; } - write_process = g_timeout_add_seconds(300, write_seen_db, NULL); + write_process = g_timeout_add_seconds(1, write_seen_db, NULL); } g_hash_table_insert(seendb, -- cgit v1.2.3 From 9c0dd994e45546871b39ad007d549b95e1a93d1c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 22:02:14 -0500 Subject: Ah, classic failure --- src/seen-db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/seen-db.c b/src/seen-db.c index b4df191..7d2fa2f 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -75,6 +75,7 @@ seen_db_init(void) g_hash_table_insert(seendb, g_strdup(desktops[i]), GINT_TO_POINTER(TRUE)); + i++; } g_strfreev(desktops); -- cgit v1.2.3 From 53575832c2a50e6eca2dba63d2d2b33ac2bbf591 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 22:37:18 -0500 Subject: When we're being reshown eval the label --- src/launcher-menu-item.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 4247738..5d9de12 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -321,6 +321,24 @@ launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed) dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE, !eclipsed); g_list_foreach(priv->shortcuts, eclipse_shortcuts_cb, GINT_TO_POINTER(eclipsed)); + + /* If we're being reshown let's re-evaluate how we should be + showing the label */ + if (!eclipsed) { + const gchar * default_name = NULL; + + if (seen_db_seen(priv->desktop)) { + default_name = get_default_name(priv->desktop); + } else { + default_name = get_default_setup(priv->desktop); + } + + if (default_name == NULL) { + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(li)); + } else { + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_LABEL, _(default_name)); + } + } return; } -- cgit v1.2.3 From 713c7d537e8b55015bad33175f4dcb90ae4ed08f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 24 Mar 2010 22:42:42 -0500 Subject: Give us a minute before we write it out. --- src/seen-db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/seen-db.c b/src/seen-db.c index 7d2fa2f..0d08801 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -161,7 +161,7 @@ seen_db_add (const gchar * desktop) write_process = 0; } - write_process = g_timeout_add_seconds(1, write_seen_db, NULL); + write_process = g_timeout_add_seconds(60, write_seen_db, NULL); } g_hash_table_insert(seendb, -- cgit v1.2.3 From db45cc036947bc462e8875b163148ee06744e8cb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Mar 2010 10:16:46 -0500 Subject: Increasing the dbusmenu required version to 0.2.8 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 98fc5a5..a8829a5 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.3.0 INDICATOR_REQUIRED_VERSION=0.3.5 -DBUSMENUGTK_REQUIRED_VERSION=0.2.5 +DBUSMENUGTK_REQUIRED_VERSION=0.2.8 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION -- cgit v1.2.3 From 3fba03247a657a3d088920511e3621572bdae4e8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Mar 2010 10:25:13 -0500 Subject: Fail if we have init called more than once. Merge comment. --- src/seen-db.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/seen-db.c b/src/seen-db.c index 0d08801..57765cc 100644 --- a/src/seen-db.c +++ b/src/seen-db.c @@ -34,9 +34,7 @@ guint write_process = 0; void seen_db_init(void) { - if (seendb != NULL) { - return; - } + g_return_if_fail(seendb == NULL); seendb = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); -- cgit v1.2.3 From 791ebdf697b50b6a54e4d7dc4e1524e7f6c30b12 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Mar 2010 10:36:41 -0500 Subject: 0.3.5 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a8829a5..e768823 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.3.4) +AM_INIT_AUTOMAKE(indicator-messages, 0.3.5) AM_MAINTAINER_MODE -- cgit v1.2.3 From 032c3937094f44093f116687c88c6c13979944c3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Mar 2010 10:51:21 -0500 Subject: debian/control: Increasing dbusmenu-glib dep to 0.2.8 --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ad2732b..6c3927e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ indicator-messages (0.3.5-0ubuntu1~ppa1) UNRELEASED; urgency=low (LP: #537312) * Track applications we've seen so that we can show "Set Up" text if we've not seen the app before. + * debian/control: Increasing dbusmenu-glib dep to 0.2.8 -- Ted Gould Thu, 25 Mar 2010 10:48:10 -0500 diff --git a/debian/control b/debian/control index 10ebc00..b2a013b 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Build-Depends: debhelper (>= 5.0), libindicate-gtk-dev (>= 0.3.0), libindicator-dev (>= 0.3.5), libdbusmenu-gtk-dev (>= 0.2.5), - libdbusmenu-glib-dev (>= 0.2.5) + libdbusmenu-glib-dev (>= 0.2.8) Standards-Version: 3.8.0 Homepage: https://launchpad.net/indicator-applet Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/indicator-messages/ubuntu -- cgit v1.2.3 From fe62bca868de09629a6077323942847290444bd9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Mar 2010 10:53:04 -0500 Subject: releasing version 0.3.5-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6c3927e..486ef15 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-messages (0.3.5-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-messages (0.3.5-0ubuntu1~ppa1) lucid; urgency=low * Upstream release 0.3.5 * Show which applications are running with a small icon @@ -9,7 +9,7 @@ indicator-messages (0.3.5-0ubuntu1~ppa1) UNRELEASED; urgency=low text if we've not seen the app before. * debian/control: Increasing dbusmenu-glib dep to 0.2.8 - -- Ted Gould Thu, 25 Mar 2010 10:48:10 -0500 + -- Ted Gould Thu, 25 Mar 2010 10:53:01 -0500 indicator-messages (0.3.4-0ubuntu1~ppa1) lucid; urgency=low -- cgit v1.2.3