diff options
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 14 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/app-menu-item.c | 6 | ||||
-rw-r--r-- | src/indicator-messages.c | 38 |
5 files changed, 41 insertions, 21 deletions
@@ -1,6 +1,6 @@ #!/bin/sh -PKG_NAME="indicator-applet" +PKG_NAME="indicator-messages" which gnome-autogen.sh || { echo "You need gnome-common from GNOME SVN" diff --git a/configure.ac b/configure.ac index 9363693..183fec8 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.1.6) +AM_INIT_AUTOMAKE(indicator-messages, 0.2.0dev) AM_MAINTAINER_MODE @@ -24,15 +24,24 @@ AC_CONFIG_MACRO_DIR([m4]) GTK_REQUIRED_VERSION=2.12 GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 -INDICATE_REQUIRED_VERSION=0.1.5 +INDICATE_REQUIRED_VERSION=0.2.0 +INDICATOR_REQUIRED_VERSION=0.2.0 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION + indicator >= $INDICATOR_REQUIRED_VERSION indicate >= $INDICATE_REQUIRED_VERSION) AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) ########################### +# Indicator Info +########################### + +INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator` +AC_SUBST(INDICATORDIR) + +########################### # Files ########################### @@ -64,4 +73,5 @@ AC_MSG_NOTICE([ Messaging Indicator Configuration: Prefix: $prefix + Indicator Dir: $INDICATORDIR ]) diff --git a/src/Makefile.am b/src/Makefile.am index eb6ba12..986e89d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ -messaginglibdir = $(libdir)/indicators/1 +messaginglibdir = $(INDICATORDIR) messaginglib_LTLIBRARIES = libmessaging.la libmessaging_la_SOURCES = indicator-messages.c im-menu-item.c im-menu-item.h app-menu-item.c app-menu-item.h libmessaging_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Wl,-Bsymbolic-functions -Wl,-z,defs -Wl,--as-needed diff --git a/src/app-menu-item.c b/src/app-menu-item.c index f6472af..7dc0f9e 100644 --- a/src/app-menu-item.c +++ b/src/app-menu-item.c @@ -221,11 +221,11 @@ update_label (AppMenuItem * self) if (priv->count_on_label && !priv->unreadcount < 1) { /* 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)"), g_app_info_get_name(priv->appinfo), priv->unreadcount); + gchar * label = g_strdup_printf(_("%s (%d)"), app_menu_item_get_name(self), priv->unreadcount); gtk_label_set_text(GTK_LABEL(priv->name), label); g_free(label); } else { - gtk_label_set_text(GTK_LABEL(priv->name), g_app_info_get_name(priv->appinfo)); + gtk_label_set_text(GTK_LABEL(priv->name), app_menu_item_get_name(self)); } return; @@ -249,7 +249,7 @@ desktop_cb (IndicateListener * listener, IndicateListenerServer * server, gchar g_return_if_fail(priv->appinfo != NULL); update_label(self); - g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, g_app_info_get_name(priv->appinfo), TRUE); + g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE); return; } diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 3df1329..b0aaffd 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -24,13 +24,16 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gtk/gtk.h> #include <libindicate/listener.h> +#include <libindicator/indicator.h> +INDICATOR_SET_VERSION +INDICATOR_SET_NAME("messages") + #include "im-menu-item.h" #include "app-menu-item.h" static IndicateListener * listener; static GList * serverList; static GtkWidget * main_image; -static GtkWidget * main_menu; static void server_count_changed (AppMenuItem * appitem, guint count, gpointer data); static void server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data); @@ -159,7 +162,7 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha gtk_menu_shell_prepend(menushell, GTK_WIDGET(menuitem)); gtk_widget_show(GTK_WIDGET(menuitem)); - gtk_widget_show(GTK_WIDGET(main_menu)); + gtk_widget_show(GTK_WIDGET(main_image)); reconsile_list_and_menu(serverList, menushell); @@ -259,7 +262,7 @@ server_removed (IndicateListener * listener, IndicateListenerServer * server, gc g_free(sltp); if (g_list_length(serverList) == 0) { - gtk_widget_hide(main_menu); + gtk_widget_hide(main_image); } else { /* Simulate a server saying zero to recalculate icon */ server_count_changed(NULL, 0, NULL); @@ -468,23 +471,30 @@ indicator_removed (IndicateListener * listener, IndicateListenerServer * server, return; } -GtkWidget * -get_menu_item (void) +GtkLabel * +get_label (void) { - design_team_size = gtk_icon_size_register("design-team-size", 22, 22); - - listener = indicate_listener_new(); - serverList = NULL; + return NULL; +} - main_menu = gtk_menu_item_new(); - gtk_widget_set_name(main_menu, "fast-user-switch-menuitem"); +GtkImage * +get_icon (void) +{ + 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); gtk_widget_show(main_image); - gtk_container_add(GTK_CONTAINER(main_menu), main_image); + + return GTK_IMAGE(main_image); +} + +GtkMenu * +get_menu (void) +{ + listener = indicate_listener_ref_default(); + serverList = NULL; GtkWidget * submenu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(main_menu), submenu); gtk_widget_show(submenu); g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), submenu); @@ -492,6 +502,6 @@ get_menu_item (void) g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), submenu); g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), submenu); - return main_menu; + return GTK_MENU(submenu); } |