[maemo-commits] [maemo-commits] r9152 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . data libhildondesktop src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Jan 17 11:23:56 EET 2007
- Previous message: [maemo-commits] r9151 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r9153 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2007-01-17 11:23:54 +0200 (Wed, 17 Jan 2007) New Revision: 9152 Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.h Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog projects/haf/branches/maemo-af-desktop/hildon-desktop/data/home-background.conf projects/haf/branches/maemo-af-desktop/hildon-desktop/data/tasknavigator.conf projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-window.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-app-switcher.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c projects/haf/branches/maemo-af-desktop/hildon-desktop/src/main.c Log: 2007-01-17 Lucas Rocha <lucas.rocha at nokia.com> * src/hd-desktop.c: use HDPanelWindow instead of HildonDesktopPanelWindow. * src/hn-app-switcher.c: explicitly set the size request depending on its orientation. * src/hn-others-button.c: don't set size request to use the panel's default one. * src/main.c: add GTK theming code. * src/Makefile.am, src/hd-panel-window.[ch]: especialized panel window with theming support. * libhildondesktop/hildon-desktop-panel.c: changed items sizing policy. If the panel item haven't set its size request, the panel used it's default values. * libhildondesktop/hildon-desktop-panel-window.c: set HANDLE_SIZE to 0. * data/tasknavigator.conf: add others menu button to default layout. Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2007-01-17 09:23:54 UTC (rev 9152) @@ -1,3 +1,21 @@ +2007-01-17 Lucas Rocha <lucas.rocha at nokia.com> + + * src/hd-desktop.c: use HDPanelWindow instead of + HildonDesktopPanelWindow. + * src/hn-app-switcher.c: explicitly set the size request depending on its + orientation. + * src/hn-others-button.c: don't set size request to use the panel's + default one. + * src/main.c: add GTK theming code. + * src/Makefile.am, src/hd-panel-window.[ch]: especialized panel window + with theming support. + * libhildondesktop/hildon-desktop-panel.c: changed items sizing + policy. If the panel item haven't set its size request, the panel used + it's default values. + * libhildondesktop/hildon-desktop-panel-window.c: set HANDLE_SIZE to + 0. + * data/tasknavigator.conf: add others menu button to default layout. + 2007-01-16 Johan Bilien <johan.bilien at nokia.com> * data/home-background.conf: Removed side and top bar, retrieve Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/home-background.conf =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/data/home-background.conf 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/data/home-background.conf 2007-01-17 09:23:54 UTC (rev 9152) @@ -1,5 +1,5 @@ [Hildon Home] -BackgroundImage=/usr/share/themes/default/images//qgn_plat_home_background.jpg +BackgroundImage=/usr/share/themes/default/images/qgn_plat_home_background.jpg Red=0 Green=0 Blue=0 Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/data/tasknavigator.conf =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/data/tasknavigator.conf 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/data/tasknavigator.conf 2007-01-17 09:23:54 UTC (rev 9152) @@ -1,3 +1,4 @@ [/usr/share/applications/hildon-navigator/hildon-task-navigator-bookmarks.desktop] [/usr/share/applications/hildon-navigator/osso-contact-plugin.desktop] +[/usr/share/applications/hildon-navigator/others-button.desktop] [/usr/share/applications/hildon-navigator/app-switcher.desktop] Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-window.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-window.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel-window.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -82,7 +82,7 @@ #define MAGIC_GEOMETRY(w) (w->priv->magic_geometry.width != -1 && w->priv->magic_geometry.height != -1) -#define HANDLE_SIZE 10 +#define HANDLE_SIZE 0 #define CHECK_MULTISCREEN_HANDLER(o) \ if (!o) \ @@ -337,17 +337,17 @@ } static GObject * -hildon_desktop_panel_window_constructor (GType gtype, - guint n_params, - GObjectConstructParam *params) +hildon_desktop_panel_window_constructor (GType gtype, + guint n_params, + GObjectConstructParam *params) { GObject *object; HildonDesktopPanelWindow *window; GtkWidget *widget; object = G_OBJECT_CLASS (hildon_desktop_panel_window_parent_class)->constructor (gtype, - n_params, - params); + n_params, + params); widget = GTK_WIDGET (object); window = HILDON_DESKTOP_PANEL_WINDOW (object); Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-panel.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -45,8 +45,8 @@ N_SIGNALS }; -#define HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_WIDTH 180 -#define HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_HEIGHT 180 +#define HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_WIDTH 80 +#define HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_HEIGHT 90 static gint signals[N_SIGNALS]; @@ -746,9 +746,8 @@ HildonDesktopPanelItem *item) { /* FIXME: Please, implement me smoothly and very optimized */ - /* FIXME: This is not that smooth implementation, this only add the item*/ - gtk_box_pack_start (GTK_BOX (panel), GTK_WIDGET (item),FALSE,FALSE,0); + gtk_box_pack_start (GTK_BOX (panel), GTK_WIDGET (item), FALSE, FALSE,0); gtk_widget_show (GTK_WIDGET (item)); } @@ -758,7 +757,9 @@ hildon_desktop_panel_add_button (HildonDesktopPanel *panel, GtkWidget *widget) { GtkWidget *panel_widget; - + GtkRequisition req; + gint width, height; + g_return_if_fail (panel && widget && HILDON_DESKTOP_IS_PANEL (panel) && @@ -766,22 +767,44 @@ panel_widget = GTK_WIDGET (panel); - if (panel->item_width != 0 && panel->item_height != 0) - { - gtk_widget_set_size_request (widget, - panel->item_width, - panel->item_height); + gtk_widget_get_child_requisition (widget, &req); + + if (req.width > 0) + { + width = req.width; } + else if (panel->item_width > 0) + { + width = panel->item_width; + } else { - gtk_widget_set_size_request (widget, - HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_WIDTH, - HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_HEIGHT); + width = HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_WIDTH; } + + if (req.height > 0) + { + height = req.height; + } + else if (panel->item_height > 0) + { + height = panel->item_height; + } + else + { + height = HILDON_DESKTOP_PANEL_WIDGET_DEFAULT_HEIGHT; + } + gtk_widget_set_size_request (widget, + width, + height); + gtk_widget_set_size_request (GTK_BIN (widget)->child, + width, + height); + if (HILDON_DESKTOP_IS_PANEL_ITEM (widget)) { - hildon_desktop_panel_calc_positions (panel,HILDON_DESKTOP_PANEL_ITEM (widget));/*FIXME: Do this! */ + hildon_desktop_panel_calc_positions (panel, HILDON_DESKTOP_PANEL_ITEM (widget));/*FIXME: Do this! */ } else { Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/Makefile.am 2007-01-17 09:23:54 UTC (rev 9152) @@ -85,6 +85,8 @@ hd-desktop.h \ hd-select-plugins-dialog.c \ hd-select-plugins-dialog.h \ + hd-panel-window.c \ + hd-panel-window.h \ hd-config.h \ main.c Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -33,7 +33,6 @@ #include <gtk/gtk.h> #include <hildon-base-lib/hildon-base-dnotify.h> -#include <libhildondesktop/hildon-desktop-panel-window.h> #include <libhildondesktop/hildon-desktop-window.h> #include "hd-desktop.h" @@ -41,6 +40,7 @@ #include "hd-config.h" #include "hd-plugin-manager.h" #include "hd-home-window.h" +#include "hd-panel-window.h" #define HD_DESKTOP_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), HD_TYPE_DESKTOP, HDDesktopPrivate)) @@ -637,7 +637,7 @@ else orientation = HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_LEFT; - container = g_object_new (HILDON_DESKTOP_TYPE_PANEL_WINDOW, + container = g_object_new (HD_TYPE_PANEL_WINDOW, "x", x, "y", y, "width", width, Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -0,0 +1,101 @@ +/* + * This file is part of hildon-desktop + * + * Copyright (C) 2006, 2007 Nokia Corporation. + * + * Author: Johan Bilien <johan.bilien at nokia.com> + * 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 + * + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +#include "hd-panel-window.h" + +#define HD_PANEL_WINDOW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HD_TYPE_PANEL_WINDOW, HDPanelWindowPrivate)) + +G_DEFINE_TYPE (HDPanelWindow, hd_panel_window, HILDON_DESKTOP_TYPE_PANEL_WINDOW); + +#define HD_PANEL_BUTTON_NAME_1 "hildon-navigator-button-one" +#define HD_PANEL_BUTTON_NAME_2 "hildon-navigator-button-two" +#define HD_PANEL_BUTTON_NAME_MIDDLE "hildon-navigator-button-three" + +static void +hd_panel_window_cadd (GtkContainer *container, + GtkWidget *widget, + gpointer user_data) +{ + GList *children = gtk_container_get_children (container); + gint position = g_list_length (children) - 1; + + if (position == 0) + { + gtk_widget_set_name (widget, HD_PANEL_BUTTON_NAME_1); + gtk_widget_set_name (GTK_BIN (widget)->child, HD_PANEL_BUTTON_NAME_1); + } + else if ((position % 2) != 0) + { + gtk_widget_set_name (widget, HD_PANEL_BUTTON_NAME_2); + gtk_widget_set_name (GTK_BIN (widget)->child, HD_PANEL_BUTTON_NAME_2); + } + else + { + gtk_widget_set_name (widget, HD_PANEL_BUTTON_NAME_MIDDLE); + gtk_widget_set_name (GTK_BIN (widget)->child, HD_PANEL_BUTTON_NAME_MIDDLE); + } +} + +static GObject * +hd_panel_window_constructor (GType gtype, + guint n_params, + GObjectConstructParam *params) +{ + GObject *object; + + object = G_OBJECT_CLASS (hd_panel_window_parent_class)->constructor (gtype, + n_params, + params); + + g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (object)->container), + "add", + G_CALLBACK (hd_panel_window_cadd), + NULL); + + return object; +} + +static void +hd_panel_window_class_init (HDPanelWindowClass *window_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (window_class); + + object_class->constructor = hd_panel_window_constructor; +} + +static void +hd_panel_window_init (HDPanelWindow *window) +{ +} Added: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.h =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.h 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-panel-window.h 2007-01-17 09:23:54 UTC (rev 9152) @@ -0,0 +1,58 @@ +/* + * This file is part of hildon-desktop + * + * Copyright (C) 2006 Nokia Corporation. + * + * Author: Johan Bilien <johan.bilien at nokia.com> + * 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 __HD_PANEL_WINDOW_H__ +#define __HD_PANEL_WINDOW_H__ + +#include <glib-object.h> +#include <libhildondesktop/hildon-desktop-panel-window.h> + +G_BEGIN_DECLS + +typedef struct _HDPanelWindow HDPanelWindow; +typedef struct _HDPanelWindowClass HDPanelWindowClass; +typedef struct _HDPanelWindowPrivate HDPanelWindowPrivate; + +#define HD_TYPE_PANEL_WINDOW (hd_panel_window_get_type ()) +#define HD_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HD_TYPE_PANEL_WINDOW, HDPanelWindow)) +#define HD_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HD_TYPE_PANEL_WINDOW, HDPanelWindowClass)) +#define HD_IS_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HD_TYPE_PANEL_WINDOW)) +#define HD_IS_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HD_TYPE_PANEL_WINDOW)) +#define HD_PANEL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HD_TYPE_PANEL_WINDOW, HDPanelWindowClass)) + +struct _HDPanelWindow +{ + HildonDesktopPanelWindow parent; +}; + +struct _HDPanelWindowClass +{ + HildonDesktopPanelWindowClass parent_class; +}; + +GType hd_panel_window_get_type (void); + +G_END_DECLS + +#endif /*__HD_PANEL_WINDOW_H__*/ Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-app-switcher.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-app-switcher.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-app-switcher.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -993,6 +993,7 @@ hn_app_switcher_build (HNAppSwitcher *app_switcher) { GtkWidget *button; + GtkRequisition req; gint i; g_assert (app_switcher); @@ -1071,6 +1072,13 @@ NULL); gtk_widget_pop_composite_child (); + + gtk_widget_size_request (GTK_WIDGET (app_switcher->box), &req); + + if (HILDON_DESKTOP_PANEL_ITEM (app_switcher)->orientation == GTK_ORIENTATION_HORIZONTAL) + gtk_widget_set_size_request (GTK_WIDGET (app_switcher), req.width, -1); + else + gtk_widget_set_size_request (GTK_WIDGET (app_switcher), -1, req.height); } /* @@ -1825,7 +1833,7 @@ hn_app_switcher_build (appswitcher); hn_app_switcher_osso_initialize (appswitcher); - + return object; } Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hn-others-button.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -145,8 +145,6 @@ gtk_container_add (GTK_CONTAINER (priv->button), icon); } - gtk_widget_set_size_request (priv->button, 80, 80); - gtk_widget_show_all (priv->button); hdwm = hd_wm_get_singleton (); Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/main.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/main.c 2007-01-17 09:16:19 UTC (rev 9151) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/main.c 2007-01-17 09:23:54 UTC (rev 9152) @@ -33,9 +33,13 @@ #include "hd-desktop.h" +#define OSSO_USER_DIR ".osso" +#define HILDON_DESKTOP_GTKRC "current-gtk-theme.maemo_af_desktop" + int main (int argc, char **argv) { GObject *desktop; + gchar *gtkrc = NULL; setlocale (LC_ALL, ""); @@ -45,6 +49,28 @@ textdomain (PACKAGE); + /* Read the maemo-af-desktop gtkrc file */ + gtkrc = g_build_filename (g_get_home_dir (), + OSSO_USER_DIR, + HILDON_DESKTOP_GTKRC, + NULL); + + if (gtkrc && g_file_test ((gtkrc), G_FILE_TEST_EXISTS)) + { + gtk_rc_add_default_file (gtkrc); + } + + g_free (gtkrc); + + /* If gtk_init was called already (maemo-launcher is used), + * re-parse the gtkrc to include the maemo-af-desktop specific one */ + if (gdk_screen_get_default ()) + { + gtk_rc_reparse_all_for_settings ( + gtk_settings_get_for_screen (gdk_screen_get_default ()), + TRUE); + } + gtk_init (&argc, &argv); desktop = hd_desktop_new ();
- Previous message: [maemo-commits] r9151 - projects/haf/tags/hildon-desktop
- Next message: [maemo-commits] r9153 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]