diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/im-menu-item.c | 6 | ||||
-rw-r--r-- | src/indicator-messages.c | 2 | ||||
-rw-r--r-- | src/messages-service.c | 88 | ||||
-rw-r--r-- | src/status-provider-mc5.c | 6 | ||||
-rw-r--r-- | test/Makefile.am | 3 |
6 files changed, 77 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac index 3d3f5ab..77ad41b 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.5.93) +AM_INIT_AUTOMAKE(indicator-messages, 0.6.0) AM_MAINTAINER_MODE diff --git a/src/im-menu-item.c b/src/im-menu-item.c index f07fff9..7466d3e 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -175,7 +175,11 @@ im_menu_item_finalize (GObject *object) static void icon_cb (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, const gchar * propertydata, gpointer data) { - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(data), INDICATOR_MENUITEM_PROP_ICON, propertydata); + gsize len; + guchar *icon; + icon = g_base64_decode (propertydata, &len); + dbusmenu_menuitem_property_set_byte_array(DBUSMENU_MENUITEM(data), INDICATOR_MENUITEM_PROP_ICON, icon, len); + g_free (icon); return; } diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 2c5e3cd..748b73b 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <math.h> #include <glib.h> #include <glib-object.h> -#include <glib/gi18n.h> +#include <glib/gi18n-lib.h> #include <gtk/gtk.h> #include <libdbusmenu-gtk/menu.h> diff --git a/src/messages-service.c b/src/messages-service.c index 6e53d85..078cee3 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -321,26 +321,58 @@ desktop_file_from_keyfile (const gchar * definition_file) return desktopfile; } +/* Check if path is a symlink and return its target if it is */ +static gchar * +get_symlink_target (const gchar *path) +{ + GFile *file; + GFileInfo *fileinfo; + gchar *target = NULL; + + file = g_file_new_for_path (path); + + fileinfo = g_file_query_info (file, "standard::is-symlink", + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, NULL); + g_object_unref (file); + + if (!fileinfo) + return NULL; + + if (g_file_info_get_is_symlink (fileinfo)) + target = g_strdup (g_file_info_get_symlink_target (fileinfo)); + + g_object_unref (fileinfo); + return target; +} + /* Add a definition file into the black list and eclipse any launchers that have the same file. */ static gboolean blacklist_add (gpointer udata) { gchar * definition_file = (gchar *)udata; - /* Dump the file */ - gchar * desktop; - g_file_get_contents(definition_file, &desktop, NULL, NULL); - if (desktop == NULL) { - g_warning("Couldn't get data out of: %s", definition_file); - return FALSE; - } + gchar * symlink_target = get_symlink_target (definition_file); + gchar * contents = NULL; - /* Clean up the data */ - gchar * trimdesktop = pango_trim_string(desktop); - g_free(desktop); - - blacklist_add_core(trimdesktop, definition_file); - g_free(trimdesktop); + if (symlink_target) + { + blacklist_add_core (symlink_target, definition_file); + g_free (symlink_target); + } + else if (g_str_has_suffix (definition_file, ".desktop")) + { + blacklist_add_core(definition_file, definition_file); + } + else if (g_file_get_contents (definition_file, &contents, NULL, NULL)) + { + gchar *trimmed = pango_trim_string (contents); + blacklist_add_core (trimmed, definition_file); + g_free (trimmed); + g_free (contents); + } + else + g_warning ("invalid blacklist entry: %s", definition_file); return FALSE; } @@ -352,8 +384,10 @@ blacklist_add (gpointer udata) static void blacklist_add_core (gchar * desktop, gchar * definition) { + gchar *basename = g_path_get_basename(desktop); + /* Check for conflicts */ - gpointer data = g_hash_table_lookup(blacklist, desktop); + gpointer data = g_hash_table_lookup(blacklist, basename); if (data != NULL) { gchar * oldfile = (gchar *)data; if (!g_strcmp0(oldfile, definition)) { @@ -362,27 +396,31 @@ blacklist_add_core (gchar * desktop, gchar * definition) g_warning("Already have desktop file '%s' in blacklist file '%s' not adding from '%s'", desktop, oldfile, definition); } + g_free(basename); return; } /* Actually blacklist this thing */ - g_hash_table_insert(blacklist, g_strdup(desktop), g_strdup(definition)); + g_hash_table_insert(blacklist, g_strdup(basename), g_strdup(definition)); g_debug("Adding Blacklist item '%s' for desktop '%s'", definition, desktop); /* Go through and eclipse folks */ GList * launcher; for (launcher = launcherList; launcher != NULL; launcher = launcher->next) { launcherList_t * item = (launcherList_t *)launcher->data; - if (!g_strcmp0(desktop, launcher_menu_item_get_desktop(item->menuitem))) { + gchar * item_basename = g_path_get_basename(launcher_menu_item_get_desktop(item->menuitem)); + if (!g_strcmp0(basename, item_basename)) { launcher_menu_item_set_eclipsed(item->menuitem, TRUE); dbusmenu_menuitem_property_set_bool(item->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); } + g_free(item_basename); } check_hidden(); /* Shouldn't need a resort here as hiding shouldn't cause things to move other than this item disappearing. */ + g_free(basename); return; } @@ -444,15 +482,20 @@ blacklist_remove (gpointer data) static gboolean blacklist_check (const gchar * desktop_file) { - g_debug("Checking blacklist for: %s", desktop_file); - if (blacklist == NULL) return FALSE; + gchar *basename = g_path_get_basename(desktop_file); + gboolean found; - if (g_hash_table_lookup(blacklist, desktop_file)) { + g_debug("Checking blacklist for: %s", basename); + + if (blacklist && g_hash_table_lookup(blacklist, basename)) { g_debug("\tFound!"); - return TRUE; + found = TRUE; } + else + found = FALSE; - return FALSE; + g_free(basename); + return found; } /* A callback everytime the blacklist directory changes @@ -621,7 +664,7 @@ server_shortcut_added (AppMenuItem * appitem, DbusmenuMenuitem * mi, gpointer da g_debug("Application Shortcut added: %s", mi != NULL ? dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL) : "none"); DbusmenuMenuitem * shell = DBUSMENU_MENUITEM(data); if (mi != NULL) { - dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_ICON_NAME, ""); + dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_ICON_NAME, DBUSMENU_MENUITEM_ICON_NAME_BLANK); dbusmenu_menuitem_child_append(shell, mi); } resort_menu(shell); @@ -1056,6 +1099,7 @@ indicator_added (IndicateListener * listener, IndicateListenerServer * server, I } else { g_warning("Unable to find server menu item"); dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem)); + resort_menu (root_menuitem); } return; diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c index e70496c..3f23565 100644 --- a/src/status-provider-mc5.c +++ b/src/status-provider-mc5.c @@ -137,7 +137,7 @@ status_provider_mc5_init (StatusProviderMC5 *self) { StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); - priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; + priv->status = STATUS_PROVIDER_STATUS_OFFLINE; priv->manager = NULL; DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); @@ -219,7 +219,7 @@ dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, con priv->manager = NULL; } - priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; + priv->status = STATUS_PROVIDER_STATUS_OFFLINE; g_signal_emit(G_OBJECT(self), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, priv->status, TRUE); } @@ -282,7 +282,7 @@ get_status (StatusProvider * sp) StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); if (priv->manager == NULL) { - return STATUS_PROVIDER_STATUS_DISCONNECTED; + return STATUS_PROVIDER_STATUS_OFFLINE; } return priv->status; diff --git a/test/Makefile.am b/test/Makefile.am index 7d6d95e..1d28dc4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -7,8 +7,7 @@ TESTS = AM_CPPFLAGS = $(GTEST_CPPFLAGS) \ -I${top_srcdir}/src -nodist_libgtest_a_SOURCES = $(GTEST_SOURCE)/src/gtest-all.cc -libgtest_a_SOURCES = \ +nodist_libgtest_a_SOURCES = \ $(GTEST_SOURCE)/src/gtest-all.cc \ $(GTEST_SOURCE)/src/gtest_main.cc libgtest_a_CPPFLAGS = \ |