[maemo-commits] [maemo-commits] r11552 - in projects/haf/trunk/hildon-desktop: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed May 9 18:24:37 EEST 2007
- Previous message: [maemo-commits] r11551 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11553 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart
Date: 2007-05-09 18:24:35 +0300 (Wed, 09 May 2007)
New Revision: 11552
Modified:
projects/haf/trunk/hildon-desktop/ChangeLog
projects/haf/trunk/hildon-desktop/src/hd-config.h
projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c
projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
Log:
* src/hd-config.h: Added thumb icon size.
* src/hd-switcher-menu-item.c: Include hd-config.h
* src/hd-switcher-menu.c:
- Implemented blinking of applications in menu icon.
* ChangeLog updated.
Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog 2007-05-09 14:47:28 UTC (rev 11551)
+++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-05-09 15:24:35 UTC (rev 11552)
@@ -1,6 +1,13 @@
2007-05-09 Moises Martinez <moises.martinez at nokia.com>
+ * src/hd-config.h: Added thumb icon size.
+ * src/hd-switcher-menu-item.c: Include hd-config.h
* src/hd-switcher-menu.c:
+ - Implemented blinking of applications in menu icon.
+
+2007-05-09 Moises Martinez <moises.martinez at nokia.com>
+
+ * src/hd-switcher-menu.c:
- Populate notifications menu at start-up.
2007-05-08 Johan Bilien <johan.bilien at nokia.com>
Modified: projects/haf/trunk/hildon-desktop/src/hd-config.h
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-config.h 2007-05-09 14:47:28 UTC (rev 11551)
+++ projects/haf/trunk/hildon-desktop/src/hd-config.h 2007-05-09 15:24:35 UTC (rev 11552)
@@ -63,4 +63,6 @@
#define HD_PLUGIN_CONFIG_KEY_SB "X-status-bar-plugin"
+#define AS_ICON_THUMB_SIZE 64
+
#endif /* __HD_CONFIG_FILES_H__ */
Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c 2007-05-09 14:47:28 UTC (rev 11551)
+++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu-item.c 2007-05-09 15:24:35 UTC (rev 11552)
@@ -22,11 +22,10 @@
/* Hildon includes */
#include "hd-switcher-menu-item.h"
#include "hn-app-pixbuf-anim-blinker.h"
+#include "hd-config.h"
#include <libhildondesktop/hildon-desktop-notification-manager.h>
-#include <stdlib.h>
-#include <string.h>
/* GLib include */
#include <glib.h>
@@ -75,7 +74,6 @@
#define AS_BUTTON_HEIGHT 38
#define AS_ROW_HEIGHT 30
#define AS_ICON_SIZE 26
-#define AS_ICON_THUMB_SIZE 64
#define AS_CLOSE_BUTTON_SIZE 16
#define AS_CLOSE_BUTTON_THUMB_SIZE 40
#define AS_TOOLTIP_WIDTH 360
Modified: projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c 2007-05-09 14:47:28 UTC (rev 11551)
+++ projects/haf/trunk/hildon-desktop/src/hd-switcher-menu.c 2007-05-09 15:24:35 UTC (rev 11552)
@@ -24,6 +24,8 @@
#include <config.h>
#endif
+#include "hd-config.h"
+
/* Hildon includes */
#include "hd-switcher-menu.h"
#include "hd-switcher-menu-item.h"
@@ -100,6 +102,8 @@
GtkWidget *icon;
GtkTreeIter *last_iter_added;
+
+ HDEntryInfo *last_urgent_info;
};
static GObject *hd_switcher_menu_constructor (GType gtype,
@@ -139,6 +143,8 @@
static void hd_switcher_menu_populate_notifications (HDSwitcherMenu *switcher);
+static void hd_switcher_menu_reset_main_icon (HDSwitcherMenu *switcher);
+
static void
hd_switcher_menu_init (HDSwitcherMenu *switcher)
{
@@ -156,6 +162,8 @@
switcher->priv->last_iter_added = NULL;
+ switcher->priv->last_urgent_info = NULL;
+
switcher->hdwm = hd_wm_get_singleton ();
switcher->nm =
@@ -663,7 +671,6 @@
hildon_desktop_popup_window_popdown (switcher->priv->popup_window);
return;
}
-
hildon_desktop_popup_window_popup
(switcher->priv->popup_window,
@@ -678,16 +685,7 @@
switcher->priv->is_open = TRUE;
- if (GTK_BIN (SWITCHER_TOGGLE_BUTTON)->child != switcher->priv->icon)
- {
- gtk_container_remove (GTK_CONTAINER (SWITCHER_TOGGLE_BUTTON),
- GTK_BIN (SWITCHER_TOGGLE_BUTTON)->child);
-
- gtk_container_add (GTK_CONTAINER (SWITCHER_TOGGLE_BUTTON),
- GTK_WIDGET (switcher->priv->icon));
-
- g_object_unref (G_OBJECT (switcher->priv->icon));
- }
+ hd_switcher_menu_reset_main_icon (switcher);
}
static void
@@ -708,6 +706,21 @@
}
static void
+hd_switcher_menu_reset_main_icon (HDSwitcherMenu *switcher)
+{
+ if (GTK_BIN (SWITCHER_TOGGLE_BUTTON)->child != switcher->priv->icon)
+ {
+ gtk_container_remove (GTK_CONTAINER (SWITCHER_TOGGLE_BUTTON),
+ GTK_BIN (SWITCHER_TOGGLE_BUTTON)->child);
+
+ gtk_container_add (GTK_CONTAINER (SWITCHER_TOGGLE_BUTTON),
+ GTK_WIDGET (switcher->priv->icon));
+
+ g_object_unref (G_OBJECT (switcher->priv->icon));
+ }
+}
+
+static void
hd_switcher_menu_create_menu (HDSwitcherMenu *switcher, HDWM *hdwm)
{
GList *children = NULL, *l;
@@ -808,6 +821,12 @@
if (l->prev && GTK_IS_SEPARATOR_MENU_ITEM (l->prev->data))
hildon_desktop_popup_menu_remove_item (switcher->priv->menu_applications,
GTK_MENU_ITEM (l->prev->data));
+
+ if (info == switcher->priv->last_urgent_info)
+ {
+ hd_switcher_menu_reset_main_icon (switcher);
+ switcher->priv->last_urgent_info = NULL;
+ }
break;
}
@@ -817,17 +836,117 @@
g_list_free (children);
}
+static GdkPixbuf *
+hd_switcher_get_default_icon_from_entry_info (HDEntryInfo *info)
+{
+ GdkPixbuf *app_pixbuf = hd_entry_info_get_icon (info);
+
+ if (!app_pixbuf)
+ {
+ GError *error = NULL;
+
+ app_pixbuf = hd_entry_info_get_app_icon (info,
+ AS_ICON_THUMB_SIZE,
+ &error);
+ if (error)
+ {
+ g_error_free (error);
+ error = NULL;
+
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+
+ app_pixbuf = gtk_icon_theme_load_icon (icon_theme,
+ AS_MENU_DEFAULT_APP_ICON,
+ AS_ICON_THUMB_SIZE,
+ GTK_ICON_LOOKUP_NO_SVG,
+ &error);
+
+ if (error)
+ {
+ g_warning ("Could not load icon %s from theme: %s.",
+ AS_MENU_DEFAULT_APP_ICON,
+ error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (icon_theme);
+ }
+ }
+
+ return app_pixbuf;
+}
+
static void
hd_switcher_menu_changed_info_cb (HDWM *hdwm,
HDEntryInfo *info,
HDSwitcherMenu *switcher)
{
+#define N_SLOTS 3
GtkWidget *menu_item = NULL;
- GList *children = NULL, *l;
+ GList *children = NULL, *apps = NULL, *l;
+ gint pos=0;
+ gboolean make_it_blink = FALSE;
+ if (!info)
+ return;
+
+ /* We have to guess whether it is in app switcher's slots or not*/
+
+ if (info->type == HD_ENTRY_WATCHED_APP)
+ {
+ apps = hd_wm_get_applications (switcher->hdwm);
+
+ for (l = apps; l != NULL; l = g_list_next (l))
+ {
+ HDEntryInfo *iter_info = (HDEntryInfo *) l->data;
+
+ if (iter_info->type != HD_ENTRY_WATCHED_APP)
+ continue;
+
+ if (iter_info->type == HD_ENTRY_WATCHED_APP)
+ {
+ pos++;
+
+ if (iter_info == info)
+ break;
+ }
+ }
+
+ if (pos >= N_SLOTS)
+ make_it_blink = TRUE;
+ }
+ else
+ {
+ apps = hd_wm_get_applications (switcher->hdwm);
+
+ for (l = apps; l != NULL; l = g_list_next (l))
+ {
+ const GList *iter_children;
+ HDEntryInfo *iter_info = (HDEntryInfo *) l->data;
+
+ if (iter_info->type == HD_ENTRY_WATCHED_APP)
+ {
+ pos++;
+
+ const GList *info_children =
+ hd_entry_info_get_children (iter_info);
+
+ for (iter_children = info_children;
+ iter_children != NULL;
+ iter_children = g_list_next (iter_children))
+ {
+ if (iter_children->data == info)
+ break;
+ }
+ }
+ }
+
+ if (pos >= N_SLOTS)
+ make_it_blink = TRUE;
+ }
+
children =
hildon_desktop_popup_menu_get_children (switcher->priv->menu_applications);
- /*TODO: Find the menu item */
for (l = children; l != NULL; l = g_list_next (l))
{
@@ -857,6 +976,13 @@
hd_entry_info_set_ignore_urgent (info, FALSE);
return;
}
+ else
+ if (!hd_entry_info_is_urgent (info) && /* We were told to change appswitcher icon with */
+ switcher->priv->last_urgent_info == info) /* application's one. Now we've been told to change it back*/
+ {
+ hd_switcher_menu_reset_main_icon (switcher);
+ switcher->priv->last_urgent_info = NULL;
+ }
if (hd_entry_info_is_urgent (info) &&
!hd_entry_info_get_ignore_urgent (info))
@@ -866,6 +992,14 @@
/* child of one of the app buttons */
if (!hd_switcher_menu_item_is_blinking (HD_SWITCHER_MENU_ITEM (menu_item)))
hd_switcher_menu_item_set_blinking (HD_SWITCHER_MENU_ITEM (menu_item), TRUE);
+
+ if (make_it_blink)
+ {
+ hd_switcher_menu_replace_blinking_icon
+ (switcher, hd_switcher_get_default_icon_from_entry_info (info));
+
+ switcher->priv->last_urgent_info = info;
+ }
}
}
}
@@ -970,6 +1104,7 @@
(switcher->priv->menu_notifications, GTK_MENU_ITEM (menu_item));
hd_switcher_menu_replace_blinking_icon (switcher, icon);
+ switcher->priv->last_urgent_info = NULL;
hildon_desktop_popup_menu_add_item
(switcher->priv->menu_notifications,
- Previous message: [maemo-commits] r11551 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11553 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
