[maemo-commits] [maemo-commits] r9517 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Feb 1 16:40:56 EET 2007
- Previous message: [maemo-commits] r9516 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9518 - projects/haf/trunk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart Date: 2007-02-01 16:40:55 +0200 (Thu, 01 Feb 2007) New Revision: 9517 Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.h Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/Makefile.am projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/statusbar-item.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-legacy.c Log: * src/hd-plugin-loader-legacy.c: - Listen to "hildon-status-bar-update-conditional" * libhildondesktop/hildon-status-bar-item.[ch]: - Added wrapper for backward compatibility * libhildondesktop/statusbar-item.c: - Rename signal to "hildon-status-bar-update-conditional" * libhildondesktop/hildon-desktop-panel-expandable.c: - Fixed the whole loading behavior * libhildondesktop/Makefile.am: - Added libhildondesktop/hildon-status-bar-item.[ch] * ChangeLog updated. Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2007-02-01 14:40:55 UTC (rev 9517) @@ -1,3 +1,16 @@ +2007-02-01 Moises Martinez <moises.martinez at nokia.com> + + * src/hd-plugin-loader-legacy.c: + - Listen to "hildon-status-bar-update-conditional" + * libhildondesktop/hildon-status-bar-item.[ch]: + - Added wrapper for backward compatibility + * libhildondesktop/statusbar-item.c: + - Rename signal to "hildon-status-bar-update-conditional" + * libhildondesktop/hildon-desktop-panel-expandable.c: + - Fixed the whole loading behavior + * libhildondesktop/Makefile.am: + - Added libhildondesktop/hildon-status-bar-item.[ch] + 2007-01-31 Johan Bilien <johan.bilien at nokia.com> * libhildondesktop/hildon-home-area.[ch]: Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/Makefile.am =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/Makefile.am 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/Makefile.am 2007-02-01 14:40:55 UTC (rev 9517) @@ -26,7 +26,8 @@ hildon-home-titlebar.h \ hildon-home-window.h \ libhildondesktop.h \ - libhildonmenu.h + libhildonmenu.h \ + hildon-status-bar-item.h EXTRA_DIST = .empty @@ -99,7 +100,9 @@ libhildonmenu.h \ libhildonmenu.c \ hildon-thumb-menu-item.h \ - hildon-thumb-menu-item.c + hildon-thumb-menu-item.c \ + hildon-status-bar-item.h \ + hildon-status-bar-item.c libhildondesktop_la_LIBADD = \ $(HILDON_LIBS) \ Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-expandable.c 2007-02-01 14:40:55 UTC (rev 9517) @@ -81,6 +81,8 @@ static void hildon_desktop_panel_expandable_finalize (GObject *object); +static void hildon_desktop_panel_expandable_arrange_items_cb (StatusbarItem *item, gboolean condition, gpointer _panel); + static void hildon_desktop_panel_expandable_arrange_items (HildonDesktopPanelExpandable *panel); static void hildon_desktop_panel_expandable_add_in_extension (HildonDesktopPanelExpandable *panel, HildonDesktopPanelItem *item); @@ -133,6 +135,8 @@ panel->priv->items = NULL; panel->priv->extension_opened = FALSE; + + panel->priv->extension_table = NULL; } GObject * @@ -262,13 +266,13 @@ g_object_get (G_OBJECT (panel), "item_width", &item_width, "item_height", &item_height, NULL); gtk_widget_set_size_request (button, item_width, item_height); - + if (STATUSBAR_IS_ITEM (button)) { - g_signal_connect (STATUSBAR_ITEM (item), - "statusbar_condition", - G_CALLBACK (hildon_desktop_panel_expandable_arrange_items), - (gpointer)ex_panel); + g_signal_connect_after (STATUSBAR_ITEM (item), + "hildon-status-bar-update-conditional", + G_CALLBACK (hildon_desktop_panel_expandable_arrange_items_cb), + (gpointer)ex_panel); } if ((ex_panel->priv->n_items+1) > ex_panel->priv->items_p_row) @@ -283,21 +287,31 @@ } if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition) - g_debug ("Statusbar: Item not visible"); + g_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id); else hildon_desktop_panel_expandable_add_in_extension (ex_panel, item); } else { - ex_panel->priv->n_items++; - + if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition) - g_debug ("Statusbar: Item not visible"); + g_debug ("Statusbar: Item not visible %s",HILDON_DESKTOP_ITEM (button)->id); else + { + ex_panel->priv->n_items++; HILDON_DESKTOP_PANEL_CLASS (hildon_desktop_panel_expandable_parent_class)->add_button (panel,button); + } } - - ex_panel->priv->items = g_list_append (ex_panel->priv->items, item); + + if (g_list_find (ex_panel->priv->items, item) == NULL) + { + if (STATUSBAR_IS_ITEM (button) && !STATUSBAR_ITEM (button)->condition) + { + gtk_object_sink (GTK_OBJECT (item)); + g_object_ref (G_OBJECT (item)); + } + ex_panel->priv->items = g_list_append (ex_panel->priv->items, item); + } } static void @@ -357,6 +371,12 @@ } static void +hildon_desktop_panel_expandable_arrange_items_cb (StatusbarItem *item, gboolean condition, gpointer _panel) +{ + hildon_desktop_panel_expandable_arrange_items (HILDON_DESKTOP_PANEL_EXPANDABLE (_panel)); +} + +static void hildon_desktop_panel_expandable_arrange_items (HildonDesktopPanelExpandable *panel) { /*TODO: Improve this!! This horribly slow!!!!! */ @@ -384,14 +404,19 @@ GTK_WIDGET (l->data)); } + for (l=panel->priv->items;l;l=g_list_next (l)){ g_debug ("2pointerrrr %p %s",l->data,HILDON_DESKTOP_ITEM (l->data)->id);} + + panel->priv->n_items = 0; + for (l = panel->priv->items; l ; l = g_list_next (l)) { - if (GTK_WIDGET_VISIBLE (l->data)) - { - hildon_desktop_panel_expandable_add_button (HILDON_DESKTOP_PANEL (panel), - GTK_WIDGET (l->data)); + hildon_desktop_panel_expandable_add_button (HILDON_DESKTOP_PANEL (panel), + GTK_WIDGET (l->data)); + + if (STATUSBAR_IS_ITEM (l->data) && !STATUSBAR_ITEM (l->data)->condition) + g_debug ("not unreffing"); + else g_object_unref (G_OBJECT (l->data)); - } } g_list_free (children_panel); Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.c 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.c 2007-02-01 14:40:55 UTC (rev 9517) @@ -0,0 +1,119 @@ +/* + * This file is part of maemo-af-desktop + * + * Copyright (C) 2005 Nokia Corporation. + * + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include "hildon-status-bar-item.h" + +void +hildon_status_bar_item_update (HildonStatusBarItem *item, gint value1, gint value2, const gchar *str) +{ + +} + +void +hildon_status_bar_item_update_conditional_cb (HildonStatusBarItem *item, gboolean user_data) +{ + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_set (item, "condition", user_data, NULL); +} + +void +hildon_status_bar_item_set_position (HildonStatusBarItem *item, gint position) +{ + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_set (G_OBJECT (item), "position",position,NULL); +} + +gint +hildon_status_bar_item_get_position (HildonStatusBarItem *item) +{ + gint position; + + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_get (G_OBJECT (item), "position", &position, NULL); + + return position; +} + +gint +hildon_status_bar_item_get_priority (HildonStatusBarItem *item) +{ + return 0; +} + +const gchar * +hildon_status_bar_item_get_name (HildonStatusBarItem *item) +{ + gchar *name = NULL; + + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_get (G_OBJECT (item), "name", &name, NULL); + + return name; +} + +gboolean +hildon_status_bar_item_get_conditional (HildonStatusBarItem *item) +{ + gboolean conditional; + + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_get (G_OBJECT (item), "conditional", &conditional, NULL); + + return conditional; +} + +gboolean +hildon_status_bar_item_get_mandatory (HildonStatusBarItem *item) +{ + gboolean mandatory; + + g_assert (STATUSBAR_IS_ITEM (item)); + + g_object_get (G_OBJECT (item), "mandatory", &mandatory, NULL); + + return mandatory; +} + +void +hildon_status_bar_item_set_button (HildonStatusBarItem *item, GtkWidget *button) +{ + g_assert (STATUSBAR_IS_ITEM (item)); + + if (button) + { + if (GTK_BIN (item)->child) + gtk_container_remove (GTK_CONTAINER (item),GTK_BIN (item)->child); + + gtk_container_add (GTK_CONTAINER (item), button); + + gtk_widget_show (button); + } +} + +GtkWidget * +hildon_status_bar_item_get_button (HildonStatusBarItem *item) +{ + g_assert (STATUSBAR_IS_ITEM (item)); + + return GTK_BIN (item)->child; +} Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.h =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.h 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-status-bar-item.h 2007-02-01 14:40:55 UTC (rev 9517) @@ -0,0 +1,178 @@ +/* + * This file is part of maemo-af-desktop + * + * Copyright (C) 2005 Nokia Corporation. + * + * Contact: Karoliina Salminen <karoliina.t.salminen at nokia.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __HILDON_STATUS_BAR_ITEM_H__ +#define __HILDON_STATUS_BAR_ITEM_H__ + +#include <libhildondesktop/statusbar-item.h> + +G_BEGIN_DECLS + +#define HILDON_STATUS_BAR_ITEM_TYPE ( status_bar_item_get_type() ) +#define HILDON_STATUS_BAR_ITEM(obj) (GTK_CHECK_CAST (obj, HILDON_STATUS_BAR_ITEM_TYPE, HildonStatusBarItem)) +#define HILDON_STATUS_BAR_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), HILDON_STATUS_BAR_ITEM_TYPE, HildonStatusBarItemClass)) +#define HILDON_IS_STATUS_BAR_ITEM(obj) (GTK_CHECK_TYPE (obj, HILDON_STATUS_BAR_ITEM_TYPE)) +#define HILDON_IS_STATUS_BAR_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), HILDON_STATUS_BAR_ITEM_TYPE)) + +typedef StatusbarItem HildonStatusBarItem; +typedef StatusbarItemClass HildonStatusBarItemClass; +typedef struct _HildonStatusBarPluginFn_st HildonStatusBarPluginFn_st; + +/* Type definitions for the plugin API */ +typedef void (*HildonStatusBarItemEntryFn)( HildonStatusBarPluginFn_st *fn ); +typedef void *(*HildonStatusBarItemInitializeFn)( HildonStatusBarItem *item, + GtkWidget **button); +typedef void (*HildonStatusBarItemDestroyFn)( void *data ); +typedef void (*HildonStatusBarItemUpdateFn)( void *data, + gint value1, + gint value2, + const gchar *str); +typedef int (*HildonStatusBarItemGetPriorityFn)( void *data ); +typedef void (*HildonStatusBarItemSetConditionalFn)( void *data, + gboolean cond ); + + +/* Struct for the plugin API function pointers */ +struct _HildonStatusBarPluginFn_st +{ + HildonStatusBarItemInitializeFn initialize; + HildonStatusBarItemDestroyFn destroy; + HildonStatusBarItemUpdateFn update; + HildonStatusBarItemGetPriorityFn get_priority; + HildonStatusBarItemSetConditionalFn set_conditional; +}; + +/** + * @hildon_status_bar_item_update + * + * @param *item the item to update + * @param value1 parameter to be given to the plugin's own update function + * @param value2 parameter to be given to the plugin's own update function + * @param str parameter to be given to the plugin's own update function + * + * Call's the item's update function and passes on the parameters. + */ +void hildon_status_bar_item_update (HildonStatusBarItem *item, + gint value1, + gint value2, + const gchar *str); + +/** + * @hildon_status_bar_item_update_conditional + * + * @param *item the item to update + * @param gboolean user_data parameter to be given + * to the plugin's own update function + * + * Call's the item's set conditional function and passes on the parameters. + */ +void hildon_status_bar_item_update_conditional_cb (HildonStatusBarItem *item, gboolean user_data); + +/** + * @hildon_status_bar_item_set_position + * + * @param *item the item to update + * @param gint position of item + * + * accessor function for setting item position + */ +void hildon_status_bar_item_set_position (HildonStatusBarItem *item, gint position); + +/** + * @hildon_status_bar_item_get_position + * + * @param *item the item to update + * + * @return gint position of the item + * + * accessor function to get item position + **/ +gint hildon_status_bar_item_get_position (HildonStatusBarItem *item); + +/** + * @hildon_status_bar_item_get_priority + * + * @param *item item to get priority from + * + * @return gint priority of the item + * + * accessor function to get item priority + */ +gint hildon_status_bar_item_get_priority (HildonStatusBarItem *item); + +/** + * @hildon_status_bar_item_get_name + * + * @param *item item to get the name + * + * @return *gchar name + * + * accessor function to get item name + */ +const gchar *hildon_status_bar_item_get_name (HildonStatusBarItem *item); + +/** + * @hildon_status_bar_item_get_conditional + * + * @param *item item to get conditional from + * + * @return gboolean conditional status of the item + * + * accessor function to get item conditional status + */ +gboolean hildon_status_bar_item_get_conditional (HildonStatusBarItem *item); + +/** +* @hildon_status_bar_item_get_mandatory +* +* @param *item item to get mandatory from +* +* @return gboolean mandatory status of the item +* +* accessor function to get item mandatory status +*/ +gboolean hildon_status_bar_item_get_mandatory (HildonStatusBarItem *item); + +/** + * @hildon_status_bar_item_set_button + * + * @param *item item to set button for + * + * accessor function to set item button + */ +void hildon_status_bar_item_set_button (HildonStatusBarItem *item, GtkWidget *button); + +/** + * @hildon_status_bar_item_get_button + * + * @param *item item to get button from + * + * @return GtkWidget* button of the item + * + * accessor function to get item button + */ +GtkWidget* hildon_status_bar_item_get_button (HildonStatusBarItem *item); + +G_END_DECLS + +#endif /*__HILDON_STATUS_BAR_ITEM_H__*/ Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/statusbar-item.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/statusbar-item.c 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/statusbar-item.c 2007-02-01 14:40:55 UTC (rev 9517) @@ -27,6 +27,7 @@ typedef enum { STATUSBAR_ITEM_CONDITION, + STATUSBAR_ITEM_CONDITION_LEGACY, SB_ITEM_SIGNALS } SBItemSignals; @@ -44,6 +45,7 @@ static void statusbar_item_class_init (StatusbarItemClass *item_class); static void statusbar_item_init (StatusbarItem *item); +static void statusbar_item_update_condition (StatusbarItem *item, gboolean condition); static void statusbar_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void statusbar_item_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); /* @@ -84,19 +86,19 @@ { GObjectClass *object_class = G_OBJECT_CLASS (item_class); - item_class->condition_update = NULL; + item_class->condition_update = statusbar_item_update_condition; object_class->get_property = statusbar_item_get_property; object_class->set_property = statusbar_item_set_property; - statusbar_signals[STATUSBAR_ITEM_CONDITION] = - g_signal_new("statusbar_condition", + statusbar_signals[STATUSBAR_ITEM_CONDITION_LEGACY] = + g_signal_new("hildon-status-bar-update-conditional", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (StatusbarItemClass,condition_update), NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); g_object_class_install_property (object_class, SB_PROP_MANDATORY, @@ -125,6 +127,14 @@ } static void +statusbar_item_update_condition (StatusbarItem *item, gboolean condition) +{ + item->condition = condition; + + g_debug ("Changing condition %s %d",HILDON_DESKTOP_ITEM (item)->id, item->condition); +} + +static void statusbar_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { StatusbarItem *sbitem = STATUSBAR_ITEM (object); Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-legacy.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-legacy.c 2007-02-01 14:37:46 UTC (rev 9516) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-legacy.c 2007-02-01 14:40:55 UTC (rev 9517) @@ -690,11 +690,8 @@ if (module_widget) { - /* FIXME */ - gtk_widget_set_size_request (module_widget, 40, 40); - gtk_widget_show_all (module_widget); - gtk_container_add (GTK_CONTAINER (item), module_widget); + gtk_widget_show (module_widget); } g_signal_connect_swapped (item, "destroy", @@ -712,7 +709,7 @@ set_conditional_data->cb = (SBSetConditional)symbols.set_conditional; set_conditional_data->module_data = module_data; - g_signal_connect (item, "notify::condition", + g_signal_connect (item, "hildon-status-bar-update-conditional", G_CALLBACK (hd_plugin_loader_legacy_status_bar_set_conditional), set_conditional_data); }
- Previous message: [maemo-commits] r9516 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9518 - projects/haf/trunk
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]