diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2009-09-24 14:22:05 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2009-09-24 14:22:05 -0400 |
commit | fd8f4f541ccc3b152c0d6f822775a643a1de0a83 (patch) | |
tree | 8e062d0776a75d044fdf47c839e686e22d130f76 | |
parent | f120bb1aba3424d2afad8648d5f40a3d4ede5661 (diff) | |
parent | 6dc6c07815ec4034e8a62ced7b3638c476ce78f8 (diff) | |
download | ayatana-indicator-messages-fd8f4f541ccc3b152c0d6f822775a643a1de0a83.tar.gz ayatana-indicator-messages-fd8f4f541ccc3b152c0d6f822775a643a1de0a83.tar.bz2 ayatana-indicator-messages-fd8f4f541ccc3b152c0d6f822775a643a1de0a83.zip |
Merged:
Ted Gould 2009-09-24 Making a 0.2.4
Ted Gould 2009-09-24 [merge] Merging in the minimum width branch to fix descriptions getting truncated when they're a reasonable length.
Ted Gould 2009-09-23 Adding in a resort after editing the blacklist
Ted Gould 2009-09-23 Too big
Ted Gould 2009-09-23 Putting in teh size request a minimum width
Ted Gould 2009-09-24 [merge] Merging in the icon scaling branch
Ted Gould 2009-09-23 Forgot to scale on icon changing.
Ted Gould 2009-09-23 Putting in a little code to scale icons.
Ted Gould 2009-09-23 Version to kick LP
Ted Gould 2009-09-23 [merge] Merging in branch to add a path for indicators in /usr/share and make it so that invalid desktop files don't create visible menu items.
Ted Gould 2009-09-23 If we're not given a valid desktop file we should eclipse ourselves, and if we're eclipsed, we should hide the separator as well.
Ted Gould 2009-09-23 Looking at the old system apps directory as well.
Ted Gould 2009-09-23 Changing directory names
Ted Gould 2009-09-17 Making a purdy 0.2.3
Ted Gould 2009-09-16 [merge] Merging in i18n branch to add i18n.
Ted Gould 2009-09-15 Forgot intltool
Ted Gould 2009-09-15 Adding in header for gettext
Ted Gould 2009-09-15 Adding in some encoding to make things fun.
Ted Gould 2009-09-15 Oops, teach me to cut and paste :)
Ted Gould 2009-09-15 Making it so the po directory is connected in.
Ted Gould 2009-09-15 Adding configure stuff in to set up gettext
Ted Gould 2009-09-15 Adding a po directory with a list of files.
Ted Gould 2009-09-15 Setting up the gettext stuff.
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | configure.ac | 32 | ||||
-rw-r--r-- | po/POTFILES.in | 7 | ||||
-rw-r--r-- | src/dirs.h | 3 | ||||
-rw-r--r-- | src/indicator-messages.c | 49 | ||||
-rw-r--r-- | src/launcher-menu-item.c | 4 | ||||
-rw-r--r-- | src/messages-service.c | 15 |
7 files changed, 106 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am index 7d58c6b..26c2a33 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = \ src \ - data + data \ + po DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall diff --git a/configure.ac b/configure.ac index 174aec6..1c67c9e 100644 --- a/configure.ac +++ b/configure.ac @@ -4,10 +4,12 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.2.2) +AM_INIT_AUTOMAKE(indicator-messages, 0.2.4) AM_MAINTAINER_MODE +IT_PROG_INTLTOOL([0.35.0]) + AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_C_O @@ -67,6 +69,33 @@ else fi AC_SUBST(DBUSSERVICEDIR) +############################## +# Custom Junk +############################## + +AC_DEFUN([AC_DEFINE_PATH], [ + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + ac_define_path=`eval echo [$]$2` + ac_define_path=`eval echo [$]ac_define_path` + $1="$ac_define_path" + AC_SUBST($1) + ifelse($3, , + AC_DEFINE_UNQUOTED($1, "$ac_define_path"), + AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) +]) + +########################### +# Internationalization +########################### + +GETTEXT_PACKAGE=indicator-messages +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain]) +AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory]) + +AM_GLIB_GNU_GETTEXT + ########################### # Files ########################### @@ -88,6 +117,7 @@ data/icons/48x48/Makefile data/icons/48x48/status/Makefile data/icons/scalable/Makefile data/icons/scalable/status/Makefile +po/Makefile.in ]) ########################### diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..0d88e74 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,7 @@ +[encoding: UTF-8] +src/messages-service-dbus.c +src/indicator-messages.c +src/messages-service.c +src/launcher-menu-item.c +src/im-menu-item.c +src/app-menu-item.c @@ -1,3 +1,4 @@ -#define SYSTEM_APPS_DIR "/etc/indicators/messages/applications" +#define SYSTEM_APPS_DIR "/usr/share/indicators/messages/applications" +#define SYSTEM_APPS_DIR_OLD "/etc/indicators/messages/applications" #define USER_APPS_DIR "indicators/messages/applications" #define USER_BLACKLIST_DIR "indicators/messages/applications-blacklist" diff --git a/src/indicator-messages.c b/src/indicator-messages.c index a3f22aa..0d0e294 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -164,7 +164,29 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, gchar * value, in is already cached, shouldn't be a big deal really. */ GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(mi, INDICATOR_MENUITEM_PROP_ICON); if (pixbuf != NULL) { - gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), pixbuf); + /* 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); + resized_pixbuf = gdk_pixbuf_scale_simple(pixbuf, + width, + height, + GDK_INTERP_BILINEAR); + } else { + g_debug("Happy with icon sized %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); + resized_pixbuf = pixbuf; + } + + gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), resized_pixbuf); + + /* The other pixbuf should be free'd by the dbusmenu. */ + if (resized_pixbuf != pixbuf) { + g_object_unref(resized_pixbuf); + } } } else { g_warning("Indicator Item property '%s' unknown", prop); @@ -194,7 +216,29 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm mi_data->icon = gtk_image_new(); GdkPixbuf * pixbuf = dbusmenu_menuitem_property_get_image(newitem, INDICATOR_MENUITEM_PROP_ICON); if (pixbuf != NULL) { - gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), pixbuf); + /* 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); + resized_pixbuf = gdk_pixbuf_scale_simple(pixbuf, + width, + height, + GDK_INTERP_BILINEAR); + } else { + g_debug("Happy with icon sized %dx%d", gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); + resized_pixbuf = pixbuf; + } + + gtk_image_set_from_pixbuf(GTK_IMAGE(mi_data->icon), resized_pixbuf); + + /* The other pixbuf should be free'd by the dbusmenu. */ + if (resized_pixbuf != pixbuf) { + g_object_unref(resized_pixbuf); + } } 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); @@ -241,6 +285,7 @@ new_launcher_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusme GtkWidget * dsc_label = gtk_label_new(""); gtk_misc_set_alignment(GTK_MISC(dsc_label), 0.05, 0.5); gtk_label_set_ellipsize(GTK_LABEL(dsc_label), PANGO_ELLIPSIZE_END); + gtk_widget_set_size_request(dsc_label, 200, -1); gchar * markup = g_markup_printf_escaped("<span font-size=\"smaller\">%s</span>", dbusmenu_menuitem_property_get(newitem, LAUNCHER_MENUITEM_PROP_APP_DESC)); gtk_label_set_markup(GTK_LABEL(dsc_label), markup); g_free(markup); diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 822196b..5afe7a9 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -137,6 +137,10 @@ launcher_menu_item_new (const gchar * desktop_file) g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); + if (priv->appinfo == NULL) { + launcher_menu_item_set_eclipsed(self, TRUE); + } + return self; } diff --git a/src/messages-service.c b/src/messages-service.c index 0ba0deb..65c9af7 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -22,6 +22,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <string.h> #include <locale.h> +#include <libintl.h> +#include <config.h> #include <pango/pango-utils.h> #include <dbus/dbus-glib-bindings.h> #include <libindicate/listener.h> @@ -348,6 +350,7 @@ blacklist_remove (gpointer data) } check_hidden(); + resort_menu(root_menuitem); return FALSE; } @@ -1146,7 +1149,10 @@ build_launcher (gpointer data) dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(ll->separator)); resort_menu(root_menuitem); - if (blacklist_check(launcher_menu_item_get_desktop(ll->menuitem))) { + /* If we're in the black list or we've gotten eclipsed + by something else, hide the item and the separator. */ + if (blacklist_check(launcher_menu_item_get_desktop(ll->menuitem)) || + launcher_menu_item_get_eclipsed(ll->menuitem)) { launcher_menu_item_set_eclipsed(ll->menuitem, TRUE); dbusmenu_menuitem_property_set(ll->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, "false"); } @@ -1220,7 +1226,11 @@ main (int argc, char ** argv) return 1; } - setlocale(LC_ALL,""); + /* Setting up i18n and gettext. Apparently, we need + all of these. */ + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + textdomain (GETTEXT_PACKAGE); dbus_interface = message_service_dbus_new(); @@ -1238,6 +1248,7 @@ main (int argc, char ** argv) g_idle_add(blacklist_init, NULL); g_idle_add(build_launchers, SYSTEM_APPS_DIR); + g_idle_add(build_launchers, SYSTEM_APPS_DIR_OLD); gchar * userdir = g_build_filename(g_get_user_config_dir(), USER_APPS_DIR, NULL); g_idle_add(build_launchers, userdir); |