[maemo-commits] [maemo-commits] r11499 - in projects/haf/trunk/hildon-desktop: . libhildondesktop src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon May 7 16:07:28 EEST 2007
- Previous message: [maemo-commits] r11498 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r11500 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2007-05-07 16:07:27 +0300 (Mon, 07 May 2007) New Revision: 11499 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml projects/haf/trunk/hildon-desktop/src/hd-desktop.c Log: 2007-05-07 Lucas Rocha <lucas.rocha at nokia.com> * src/hd-desktop.c, libhildondesktop/hildon-desktop-notification-manager.[ch], libhildondesktop/notification-manager.xml: support for setting the button label on system.note.dialog to cover the open "closeable" dialogs case. Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-05-07 12:42:57 UTC (rev 11498) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-05-07 13:07:27 UTC (rev 11499) @@ -1,3 +1,10 @@ +2007-05-07 Lucas Rocha <lucas.rocha at nokia.com> + + * src/hd-desktop.c, libhildondesktop/hildon-desktop-notification-manager.[ch], + libhildondesktop/notification-manager.xml: support for setting the + button label on system.note.dialog to cover the open "closeable" + dialogs case. + 2007-05-07 Johan Bilien <johan.bilien at nokia.com> * configure.ac: 0.0.11 Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c 2007-05-07 12:42:57 UTC (rev 11498) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.c 2007-05-07 13:07:27 UTC (rev 11499) @@ -455,11 +455,13 @@ hildon_desktop_notification_manager_system_note_dialog (HildonDesktopNotificationManager *nm, const gchar *message, guint type, + const gchar *label, DBusGMethodInvocation *context) { GHashTable *hints; GValue *hint; - + gchar **actions; + static const gchar *icon[4] = { "qgn_note_gene_syswarning", /* OSSO_GN_WARNING */ "qgn_note_gene_syserror", /* OSSO_GN_ERROR */ @@ -467,8 +469,6 @@ "qgn_note_gene_wait" /* OSSO_GN_WAIT */ }; - g_debug ("ALOW ALOW ALOW ALOW"); - hints = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, @@ -480,18 +480,39 @@ g_hash_table_insert (hints, "category", hint); + if (!g_str_equal (label, "")) + { + GArray *actions_arr; + gchar *action_id, *action_label; + + actions_arr = g_array_sized_new (TRUE, FALSE, sizeof (gchar *), 2); + + action_id = g_strdup ("default"); + action_label = g_strdup (label); + + g_array_append_val (actions_arr, action_id); + g_array_append_val (actions_arr, action_label); + + actions = (gchar **) g_array_free (actions_arr, FALSE); + } + else + { + actions = NULL; + } + hildon_desktop_notification_manager_notify (nm, "hildon-desktop", 0, icon[type], "System Note Dialog", message, - NULL, + actions, hints, 3000, context); g_hash_table_destroy (hints); + g_strfreev (actions); return TRUE; } Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h 2007-05-07 12:42:57 UTC (rev 11498) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-notification-manager.h 2007-05-07 13:07:27 UTC (rev 11499) @@ -100,6 +100,7 @@ gboolean hildon_desktop_notification_manager_system_note_dialog (HildonDesktopNotificationManager *nm, const gchar *message, guint type, + const gchar *label, DBusGMethodInvocation *context); gboolean hildon_desktop_notification_manager_get_capabilities (HildonDesktopNotificationManager *nm, Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml 2007-05-07 12:42:57 UTC (rev 11498) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/notification-manager.xml 2007-05-07 13:07:27 UTC (rev 11499) @@ -44,6 +44,7 @@ <arg type="s" name="message" direction="in" /> <arg type="u" name="type" direction="in" /> + <arg type="s" name="label" direction="in" /> <arg type="u" name="return_id" direction="out" /> </method> Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c =================================================================== --- projects/haf/trunk/hildon-desktop/src/hd-desktop.c 2007-05-07 12:42:57 UTC (rev 11498) +++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c 2007-05-07 13:07:27 UTC (rev 11499) @@ -658,171 +658,8 @@ } #if 0 -#ifdef HAVE_LIBOSSO -static gint -hildon_desktop_rpc_cb (const gchar *interface, - const gchar *method, - GArray *arguments, - gpointer data, - osso_rpc_t *retval) -{ - HDDesktop *desktop; - osso_rpc_t *val[5]; - gint i; - - if (!interface || !method || !arguments || !data) + if (g_str_equal ("delayed_infobanner", method)) { - return OSSO_ERROR; - } - - desktop = (HDDesktop *) data; - - for (i = 0; i < arguments->len; ++i) - { - val[i] = &g_array_index (arguments, osso_rpc_t, i); - } - - if (g_str_equal("system_note_infoprint", method)) - { - if (arguments->len < 1 || val[0]->type != DBUS_TYPE_STRING ) - { - if (arguments->len < 1) - { - retval->value.s = g_strdup ("Not enough args to infoprint"); - } - else - { - g_sprintf (retval->value.s, - "Wrong type param to infoprint (%d)", val[0]->type); - } - - g_warning (retval->value.s); - - return OSSO_ERROR; - } - - hildon_banner_show_information( NULL, NULL, val[0]->value.s); - } - else if (g_str_equal ("system_note_dialog", method)) - { - if (arguments->len < 2 || - val[0]->type != DBUS_TYPE_STRING || - val[1]->type != DBUS_TYPE_INT32 ) - { - if (arguments->len < 2) - { - retval->value.s = "Not enough args to dialog"; - } - else - { - retval->value.s = "Wrong type of arguments to dialog"; - } - - g_warning (retval->value.s); - - return OSSO_ERROR; - } - - hildon_status_bar_lib_prepare_dialog (val[1]->value.i, - NULL, - val[0]->value.s, - 0, - NULL, - NULL); - } - else if (g_str_equal ("open_closeable_system_dialog", method)) - { - gint id; - const gchar *btext = NULL; - - if (arguments->len < 4 || - val[0]->type != DBUS_TYPE_STRING || - val[1]->type != DBUS_TYPE_INT32 || - val[2]->type != DBUS_TYPE_STRING || - val[3]->type != DBUS_TYPE_BOOLEAN) - { - retval->type = DBUS_TYPE_STRING; - - if (arguments->len < 4) - { - retval->value.s = g_strdup ("Not enough args to dialog"); - } - else - { - retval->value.s = g_strdup ("Wrong type of arguments to dialog"); - } - - g_warning (retval->value.s); - - return OSSO_ERROR; - } - - if ((val[2]->value.s)[0] != '\0') - { - btext = val[2]->value.s; - } - - id = hildon_status_bar_lib_open_closeable_dialog (val[1]->value.i, - val[0]->value.s, - btext, - val[0]->value.b); - - retval->type = DBUS_TYPE_INT32; - retval->value.i = id; - } - else if (g_str_equal ("close_closeable_system_dialog", method)) - { - /* The id of the dialog is given as argument */ - if (arguments->len < 1 || val[0]->type != DBUS_TYPE_INT32) - { - retval->type = DBUS_TYPE_STRING; - - if (arguments->len < 1) - { - retval->value.s = g_strdup ("Not enough args to dialog"); - } - else - { - retval->value.s = g_strdup ("Argument has invalid type"); - } - - g_warning (retval->value.s); - - return OSSO_ERROR; - } - - hildon_status_bar_lib_close_closeable_dialog (val[0]->value.i); - } - else if (g_str_equal( "get_system_dialog_response", method)) - { - gint response = -1; - - /* The id of the dialog is given as argument */ - if (arguments->len < 1 || val[0]->type != DBUS_TYPE_INT32) - { - retval->type = DBUS_TYPE_STRING; - - if (arguments->len < 1) - { - retval->value.s = g_strdup ("Not enough args to dialog"); - } - else - { - retval->value.s = g_strdup ("Argument has invalid type"); - } - - g_warning (retval->value.s); - - return OSSO_ERROR; - } - - response = hildon_status_bar_lib_get_dialog_response (val[0]->value.i); - - retval->type = DBUS_TYPE_INT32; - retval->value.i = response; - } - else if (g_str_equal ("delayed_infobanner", method)) - { gint parent_window_id = 0; if (arguments->len < 4 || @@ -891,62 +728,7 @@ return OSSO_OK; } - else if( g_str_equal( "statusbar_insensitive", method )) - { - sb_is_sensitive = FALSE; - - gtk_container_foreach (GTK_CONTAINER (panel->fixed), - (GtkCallback) (statusbar_insensitive_cb), - NULL); - - gtk_container_foreach (GTK_CONTAINER (panel->arrow_button), - (GtkCallback) (statusbar_insensitive_cb), - NULL); - - return OSSO_OK; - } - else if (g_str_equal("statusbar_sensitive", method)) - { - sb_is_sensitive = TRUE; - - gtk_container_foreach (GTK_CONTAINER (panel->fixed), - (GtkCallback) (statusbar_sensitive_cb), - NULL); - - gtk_container_foreach (GTK_CONTAINER (panel->arrow_button), - (GtkCallback) (statusbar_sensitive_cb), - NULL); - - return OSSO_OK; - } - else if (g_str_equal("statusbar_get_conditional", method)) - { - int i; - - for (i = 0; i < HSB_MAX_NO_OF_ITEMS; i++) /* Can we break earlier? */ - { - if (panel->items[i]) - { - statusbar_send_signal (osso_get_dbus_connection (panel->osso), - HILDON_STATUS_BAR_ITEM (panel->items[i]), - hildon_status_bar_item_get_conditional - (HILDON_STATUS_BAR_ITEM (panel->items[i]))); - } - } - - return OSSO_OK; - } - else - { - g_warning ("Unknown SB RPC method"); - - return OSSO_ERROR; - } - - return OSSO_OK; -} #endif -#endif static void hd_desktop_load_containers (HDDesktop *desktop) @@ -1389,14 +1171,29 @@ static GtkWidget * hd_desktop_create_note_dialog (const gchar *summary, const gchar *body, - const gchar *icon_name) + const gchar *icon_name, + gchar **actions) { GtkWidget *note; - + gint i; + note = hildon_note_new_information_with_icon_name (NULL, body, icon_name); + /* If there's a default action, get the label and set + * the button text */ + for (i = 0; actions && actions[i] != NULL; i += 2) + { + gchar *label = actions[i + 1]; + + if (g_str_equal (actions[i], "default")) + { + hildon_note_set_button_text (HILDON_NOTE (note), label); + break; + } + } + return note; } @@ -1428,6 +1225,7 @@ GtkWidget *notification = NULL; GHashTable *hints; GValue *hint; + gchar **actions; const gchar *hint_s; gchar *summary; gchar *body; @@ -1444,6 +1242,7 @@ HD_NM_COL_SUMMARY, &summary, HD_NM_COL_BODY, &body, HD_NM_COL_ICON_NAME, &icon_name, + HD_NM_COL_ACTIONS, &actions, HD_NM_COL_HINTS, &hints, -1); @@ -1464,7 +1263,8 @@ notification = hd_desktop_create_note_dialog (summary, body, - icon_name); + icon_name, + actions); ninfo = g_new0 (HDDesktopNotificationInfo, 1);
- Previous message: [maemo-commits] r11498 - in projects/haf/trunk/hildon-theme-layout-4: . rc
- Next message: [maemo-commits] r11500 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]