[gnome-main-menu/gnome-3] initial gnome-3 port



commit 19af9e3cfb70515c1634a7ce4a768ecc852bb7f0
Author: Michael Meeks <michael meeks novell com>
Date:   Tue Sep 13 18:01:19 2011 +0200

    initial gnome-3 port

 application-browser/src/application-browser.c |   13 ++-
 configure.in                                  |   16 +--
 main-menu/src/eggaccelerators.c               |   12 +-
 main-menu/src/hard-drive-status-tile.c        |   15 +--
 main-menu/src/main-menu-migration.c           |   73 +++++++-----
 main-menu/src/main-menu-ui.c                  |  158 +++++++++++++------------
 main-menu/src/main-menu.c                     |    5 +-
 main-menu/src/tile-table.c                    |    4 +-
 main-menu/src/tomboykeybinder.c               |    6 +-
 main-menu/src/trigger-panel-run-dialog.c      |    8 +-
 10 files changed, 170 insertions(+), 140 deletions(-)
---
diff --git a/application-browser/src/application-browser.c b/application-browser/src/application-browser.c
index f986b7a..1b60e9b 100644
--- a/application-browser/src/application-browser.c
+++ b/application-browser/src/application-browser.c
@@ -23,8 +23,6 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
-#include <libgnome/gnome-desktop-item.h>
-#include <unique/unique.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
 #include <libslab/slab.h>
@@ -32,6 +30,7 @@
 #define APPLICATION_BROWSER_PREFIX  "/desktop/gnome/applications/main-menu/ab_"
 #define NEW_APPS_MAX_ITEMS  (APPLICATION_BROWSER_PREFIX "new_apps_max_items")
 
+#ifdef PORTING_REQUIRED
 static UniqueResponse
 unique_app_message_cb (UniqueApp *app, gint command, UniqueMessageData *data,
 		       guint time, gpointer user_data)
@@ -52,11 +51,14 @@ unique_app_message_cb (UniqueApp *app, gint command, UniqueMessageData *data,
 
 	return UNIQUE_RESPONSE_OK;
 }
+#endif
 
 int
 main (int argc, char *argv[])
 {
+#ifdef PORTING_REQUIRED
 	UniqueApp *unique_app = NULL;
+#endif
 	gboolean hidden = FALSE;
 	GError *error;
 	GOptionEntry options[] = {
@@ -78,6 +80,8 @@ main (int argc, char *argv[])
 		return 1;
 	}
 
+	g_warning ("Turn me into a GApplication!");
+#ifdef PORTING_REQUIRED
 	unique_app = unique_app_new ("org.gnome.MainMenu", NULL);
 
 	if (unique_app_is_running (unique_app))
@@ -87,6 +91,7 @@ main (int argc, char *argv[])
 
 		return 0;
 	}
+#endif
 
 	NewAppConfig *config = g_new0 (NewAppConfig, 1);
 	config->max_items = get_slab_gconf_int (NEW_APPS_MAX_ITEMS);
@@ -100,12 +105,16 @@ main (int argc, char *argv[])
 	create_main_window (app_data, "MyApplicationBrowser", _("Application Browser"),
 		"gnome-fs-client", 940, 600, hidden);
 
+#ifdef PORTING_REQUIRED
 	unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
 	g_signal_connect (unique_app, "message-received", G_CALLBACK (unique_app_message_cb), app_data);
+#endif
 
 	gtk_main ();
 
+#ifdef PORTING_REQUIRED
 	g_object_unref (unique_app);
+#endif
 
 	return 0;
 };
diff --git a/configure.in b/configure.in
index 321cb6f..8934941 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-AC_INIT([gnome-main-menu], [0.9.17], [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-main-menu])
+AC_INIT([gnome-main-menu], [3.0.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-main-menu])
 
 AC_CONFIG_SRCDIR([.])
 AC_CONFIG_HEADERS([config.h])
@@ -31,24 +31,22 @@ dnl Check that we meet the dependencies
 dnl ==============================================
 
 GLIB_REQUIRED=2.16.0
-GTK_REQUIRED=2.18
-SLAB_REQUIRED=2.29.0
+GTK_REQUIRED=3.0.0
+SLAB_REQUIRED=3.0.0
 
 AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject)
 
 COMMON_MODULES="glib-2.0 >= $GLIB_REQUIRED	\
 		gio-2.0 >= $GLIB_REQUIRED 	\
 		gobject-2.0 			\
-		gtk+-2.0 >= $GTK_REQUIRED 	\
-		gdk-2.0				\
-		libslab >= $SLAB_REQUIRED"
+		gtk+-3.0 >= $GTK_REQUIRED 	\
+		libslab-3 >= $SLAB_REQUIRED"
 
-
-PKG_CHECK_MODULES(APPLICATION_BROWSER, [ $COMMON_MODULES gnome-desktop-2.0 unique-1.0 ])
+PKG_CHECK_MODULES(APPLICATION_BROWSER, [ $COMMON_MODULES gnome-desktop-3.0 ])
 AC_SUBST(APPLICATION_BROWSER_CFLAGS)
 AC_SUBST(APPLICATION_BROWSER_LIBS)
 
-PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-2.0 gnome-desktop-2.0 gconf-2.0 libgtop-2.0 libxml-2.0 x11 cairo ])
+PKG_CHECK_MODULES(MAIN_MENU, [ $COMMON_MODULES libpanelapplet-4.0 gnome-desktop-3.0 gconf-2.0 libgtop-2.0 libxml-2.0 x11 cairo ])
 AC_SUBST(MAIN_MENU_CFLAGS)
 AC_SUBST(MAIN_MENU_LIBS)
 
diff --git a/main-menu/src/eggaccelerators.c b/main-menu/src/eggaccelerators.c
index 6d4f484..708d43b 100644
--- a/main-menu/src/eggaccelerators.c
+++ b/main-menu/src/eggaccelerators.c
@@ -559,17 +559,17 @@ reload_modmap (GdkKeymap * keymap, EggModmap * modmap)
 		j = 0;
 		while (j < n_entries)
 		{
-			if (keyvals[j] == GDK_Num_Lock)
+			if (keyvals[j] == GDK_KEY_Num_Lock)
 				mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
-			else if (keyvals[j] == GDK_Scroll_Lock)
+			else if (keyvals[j] == GDK_KEY_Scroll_Lock)
 				mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
-			else if (keyvals[j] == GDK_Meta_L || keyvals[j] == GDK_Meta_R)
+			else if (keyvals[j] == GDK_KEY_Meta_L || keyvals[j] == GDK_KEY_Meta_R)
 				mask |= EGG_VIRTUAL_META_MASK;
-			else if (keyvals[j] == GDK_Hyper_L || keyvals[j] == GDK_Hyper_R)
+			else if (keyvals[j] == GDK_KEY_Hyper_L || keyvals[j] == GDK_KEY_Hyper_R)
 				mask |= EGG_VIRTUAL_HYPER_MASK;
-			else if (keyvals[j] == GDK_Super_L || keyvals[j] == GDK_Super_R)
+			else if (keyvals[j] == GDK_KEY_Super_L || keyvals[j] == GDK_KEY_Super_R)
 				mask |= EGG_VIRTUAL_SUPER_MASK;
-			else if (keyvals[j] == GDK_Mode_switch)
+			else if (keyvals[j] == GDK_KEY_Mode_switch)
 				mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
 
 			++j;
diff --git a/main-menu/src/hard-drive-status-tile.c b/main-menu/src/hard-drive-status-tile.c
index 16026dc..f36e026 100644
--- a/main-menu/src/hard-drive-status-tile.c
+++ b/main-menu/src/hard-drive-status-tile.c
@@ -37,7 +37,7 @@
 G_DEFINE_TYPE (HardDriveStatusTile, hard_drive_status_tile, NAMEPLATE_TILE_TYPE)
 
 static void hard_drive_status_tile_finalize (GObject *);
-static void hard_drive_status_tile_destroy (GtkObject *);
+static void hard_drive_status_tile_dispose (GObject *);
 static void hard_drive_status_tile_style_set (GtkWidget *, GtkStyle *);
 
 static void hard_drive_status_tile_activated (Tile *, TileEvent *);
@@ -66,13 +66,11 @@ typedef struct
 static void hard_drive_status_tile_class_init (HardDriveStatusTileClass * hd_tile_class)
 {
 	GObjectClass *g_obj_class = G_OBJECT_CLASS (hd_tile_class);
-	GtkObjectClass *gtk_obj_class = GTK_OBJECT_CLASS (hd_tile_class);
 	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (hd_tile_class);
 	TileClass *tile_class = TILE_CLASS (hd_tile_class);
 
 	g_obj_class->finalize = hard_drive_status_tile_finalize;
-
-	gtk_obj_class->destroy = hard_drive_status_tile_destroy;
+	g_obj_class->dispose = hard_drive_status_tile_dispose;
 
 	widget_class->style_set = hard_drive_status_tile_style_set;
 
@@ -104,8 +102,10 @@ hard_drive_status_tile_new ()
 
 	subheader = gtk_label_new (NULL);
 	gtk_misc_set_alignment (GTK_MISC (subheader), 0.0, 0.5);
+#ifdef PORTING_MORE
 	gtk_widget_modify_fg (subheader, GTK_STATE_NORMAL,
 		&subheader->style->fg[GTK_STATE_INSENSITIVE]);
+#endif
 
 	tile = g_object_new (HARD_DRIVE_STATUS_TILE_TYPE, "tile-uri", "tile://hard-drive-status",
 		"nameplate-image", image, "nameplate-header", header, "nameplate-subheader",
@@ -153,7 +153,7 @@ hard_drive_status_tile_finalize (GObject * g_object)
 }
 
 static void
-hard_drive_status_tile_destroy (GtkObject * gtk_object)
+hard_drive_status_tile_dispose (GObject * gtk_object)
 {
 	HardDriveStatusTile *tile = HARD_DRIVE_STATUS_TILE (gtk_object);
 	HardDriveStatusTilePrivate *priv = HARD_DRIVE_STATUS_TILE_GET_PRIVATE (tile);
@@ -322,9 +322,8 @@ tile_show_event_cb (GtkWidget * widget, gpointer user_data)
 static void
 open_hard_drive_tile (Tile * tile, TileEvent * event, TileAction * action)
 {
-	GnomeDesktopItem *ditem;
+	GKeyFile *ditem;
 	gchar *fb_ditem_id;
-	
 
 	fb_ditem_id = (gchar *) libslab_get_gconf_value (SYSTEM_MONITOR_GCONF_KEY);
 
@@ -336,6 +335,6 @@ open_hard_drive_tile (Tile * tile, TileEvent * event, TileAction * action)
 	if (! open_desktop_item_exec (ditem))
 		g_warning ("open_hard_drive_tile: couldn't exec item\n");
 
-	gnome_desktop_item_unref (ditem);
+	g_object_unref (ditem);
 	g_free (fb_ditem_id);
 }
diff --git a/main-menu/src/main-menu-migration.c b/main-menu/src/main-menu-migration.c
index ccfc2f7..cbf505f 100644
--- a/main-menu/src/main-menu-migration.c
+++ b/main-menu/src/main-menu-migration.c
@@ -93,7 +93,7 @@ migrate_system_gconf_to_bookmark_file ()
 
 	GList            *gconf_system_list;
 	gint              system_tile_type;
-	GnomeDesktopItem *ditem;
+	GKeyFile *ditem;
 	gchar            *path;
 	const gchar      *loc;
 	gchar            *uri;
@@ -178,33 +178,44 @@ migrate_system_gconf_to_bookmark_file ()
 					exec_string = (gchar *) node_j->data;
 
 					g_shell_parse_argv (exec_string, NULL, & argv, NULL);
-		
+
 					cmd_path = g_find_program_in_path (argv [0]);
 
 					if (cmd_path) {
-						ditem = gnome_desktop_item_new ();
+						ditem = g_key_file_new ();
 
 						path = g_build_filename (
 							g_get_user_data_dir (), PACKAGE, "lockscreen.desktop", NULL);
 
-						gnome_desktop_item_set_location_file (ditem, path);
-						gnome_desktop_item_set_string (
-							ditem, GNOME_DESKTOP_ITEM_NAME, _("Lock Screen"));
-						gnome_desktop_item_set_string (
-							ditem, GNOME_DESKTOP_ITEM_ICON, "gnome-lockscreen");
-						gnome_desktop_item_set_string (
-							ditem, GNOME_DESKTOP_ITEM_EXEC, exec_string);
-						gnome_desktop_item_set_boolean (
-							ditem, GNOME_DESKTOP_ITEM_TERMINAL, FALSE);
-						gnome_desktop_item_set_entry_type (
-							ditem, GNOME_DESKTOP_ITEM_TYPE_APPLICATION);
-						gnome_desktop_item_set_string (
-							ditem, GNOME_DESKTOP_ITEM_CATEGORIES, "GNOME;GTK;");
-						gnome_desktop_item_set_string (
-							ditem, GNOME_DESKTOP_ITEM_ONLY_SHOW_IN, "GNOME;");
-
-						gnome_desktop_item_save (ditem, NULL, TRUE, NULL);
-
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_NAME, _("Lock Screen"));
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_ICON, "gnome-lockscreen");
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_EXEC, exec_string);
+						g_key_file_set_boolean (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_TERMINAL, FALSE);
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_TYPE,
+							G_KEY_FILE_DESKTOP_TYPE_APPLICATION);
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_CATEGORIES, "GNOME;GTK;");
+						g_key_file_set_string (
+							ditem, G_KEY_FILE_DESKTOP_GROUP,
+							G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, "GNOME;");
+
+						{ /* save */
+							gsize  length;
+							gchar *flat_text = g_key_file_to_data (ditem,
+											       &length, NULL);
+							g_file_set_contents (path, flat_text, length, NULL);
+						}
 						g_free (path);
 
 						break;
@@ -225,7 +236,7 @@ migrate_system_gconf_to_bookmark_file ()
 				ditem = NULL;
 
 			if (ditem) {
-				loc = gnome_desktop_item_get_location (ditem);
+				loc = libslab_keyfile_get_location (ditem);
 
 				if (g_path_is_absolute (loc))
 					uri = g_filename_to_uri (loc, NULL, NULL);
@@ -239,10 +250,10 @@ migrate_system_gconf_to_bookmark_file ()
 				g_bookmark_file_set_mime_type (bm_file, uri, "application/x-desktop");
 				g_bookmark_file_add_application (
 					bm_file, uri,
-					gnome_desktop_item_get_localestring (ditem, GNOME_DESKTOP_ITEM_NAME),
-					gnome_desktop_item_get_localestring (ditem, GNOME_DESKTOP_ITEM_EXEC));
+					libslab_keyfile_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_NAME),
+					libslab_keyfile_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_EXEC));
 
-				name = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_NAME);
+				name = libslab_keyfile_get (ditem, G_KEY_FILE_DESKTOP_KEY_NAME);
 
 				if (! strcmp (name, "Yelp"))
 					g_bookmark_file_set_title (bm_file, uri, _("Help"));
@@ -255,7 +266,7 @@ migrate_system_gconf_to_bookmark_file ()
 			g_free (uri);
 
 			if (ditem)
-				gnome_desktop_item_unref (ditem);
+				g_object_unref (ditem);
 		}
 
 		bm_path = g_build_filename (bm_dir, SYSTEM_BOOKMARK_FILENAME, NULL);
@@ -283,7 +294,7 @@ migrate_user_apps_gconf_to_bookmark_file ()
 
 	GList *user_apps_list;
 
-	GnomeDesktopItem *ditem;
+	GKeyFile *ditem;
 	const gchar      *loc;
 	gchar            *uri;
 
@@ -314,7 +325,7 @@ migrate_user_apps_gconf_to_bookmark_file ()
 		ditem = libslab_gnome_desktop_item_new_from_unknown_id ((gchar *) node->data);
 
 		if (ditem) {
-			loc = gnome_desktop_item_get_location (ditem);
+			loc = libslab_keyfile_get_location (ditem);
 
 			if (g_path_is_absolute (loc))
 				uri = g_filename_to_uri (loc, NULL, NULL);
@@ -328,14 +339,14 @@ migrate_user_apps_gconf_to_bookmark_file ()
 			g_bookmark_file_set_mime_type (bm_file, uri, "application/x-desktop");
 			g_bookmark_file_add_application (
 				bm_file, uri,
-				gnome_desktop_item_get_localestring (ditem, GNOME_DESKTOP_ITEM_NAME),
-				gnome_desktop_item_get_localestring (ditem, GNOME_DESKTOP_ITEM_EXEC));
+				libslab_keyfile_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_NAME),
+				libslab_keyfile_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_EXEC));
 		}
 
 		g_free (uri);
 
 		if (ditem)
-			gnome_desktop_item_unref (ditem);
+			g_object_unref (ditem);
 
 		g_free (node->data);
 	}
diff --git a/main-menu/src/main-menu-ui.c b/main-menu/src/main-menu-ui.c
index f59afc4..5329b2d 100644
--- a/main-menu/src/main-menu-ui.c
+++ b/main-menu/src/main-menu-ui.c
@@ -33,6 +33,7 @@
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
 #include <gio/gio.h>
+#include <glib/gi18n.h>
 #include <unistd.h>
 #include <libslab/slab.h>
 
@@ -189,7 +190,7 @@ static void     panel_button_clicked_cb           (GtkButton *, gpointer);
 static gboolean panel_button_button_press_cb      (GtkWidget *, GdkEventButton *, gpointer);
 static void     panel_button_drag_data_rcv_cb     (GtkWidget *, GdkDragContext *, gint, gint,
                                                    GtkSelectionData *, guint, guint, gpointer);
-static gboolean slab_window_expose_cb             (GtkWidget *, GdkEventExpose *, gpointer);
+static gboolean slab_window_draw_cb               (GtkWidget *, cairo_t *cr, gpointer);
 static gboolean slab_window_key_press_cb          (GtkWidget *, GdkEventKey *, gpointer);
 static gboolean slab_window_button_press_cb       (GtkWidget *, GdkEventButton *, gpointer);
 static void     slab_window_allocate_cb           (GtkWidget *, GtkAllocation *, gpointer);
@@ -205,11 +206,11 @@ static void     more_buttons_clicked_cb            (GtkButton *, gpointer);
 static void     search_cmd_notify_cb              (GConfClient *, guint, GConfEntry *, gpointer);
 static void     current_page_notify_cb            (GConfClient *, guint, GConfEntry *, gpointer);
 static void     lockdown_notify_cb                (GConfClient *, guint, GConfEntry *, gpointer);
-static void     panel_menu_open_cb                (BonoboUIComponent *, gpointer, const gchar *);
-static void     panel_menu_about_cb               (BonoboUIComponent *, gpointer, const gchar *);
 static void     panel_applet_change_orient_cb     (PanelApplet *, PanelAppletOrient, gpointer);
-static void     panel_applet_change_background_cb (PanelApplet *, PanelAppletBackgroundType, GdkColor *,
+#ifdef MORE_PORTING
+ static void     panel_applet_change_background_cb (PanelApplet *, PanelAppletBackgroundType, GdkColor *,
                                                    GdkPixmap * pixmap, gpointer);
+#endif
 static void     slab_window_tomboy_bindkey_cb     (gchar *, gpointer);
 static void     search_tomboy_bindkey_cb          (gchar *, gpointer);
 static gboolean grabbing_window_event_cb          (GtkWidget *, GdkEvent *, gpointer);
@@ -219,11 +220,13 @@ static void     volume_monitor_mount_cb           (GVolumeMonitor *, GMount *, g
 
 static GdkFilterReturn slab_gdk_message_filter (GdkXEvent *, GdkEvent *, gpointer);
 
+#ifdef MORE_PORTING
 static const BonoboUIVerb applet_bonobo_verbs [] = {
 	BONOBO_UI_UNSAFE_VERB ("MainMenuOpen",  panel_menu_open_cb),
 	BONOBO_UI_UNSAFE_VERB ("MainMenuAbout", panel_menu_about_cb),
 	BONOBO_UI_VERB_END
 };
+#endif
 
 static const gchar *main_menu_authors [] = {
 	"Jim Krehl <jimmyk novell com>",
@@ -550,6 +553,7 @@ create_panel_button (MainMenuUI *this)
 
 	reorient_panel_button (this);
 
+#ifdef MORE_PORTING
 	panel_applet_setup_menu_from_file (
 		priv->panel_applet, NULL, "GNOME_MainMenu_ContextMenu.xml",
 		NULL, applet_bonobo_verbs, this);
@@ -561,6 +565,8 @@ create_panel_button (MainMenuUI *this)
 	g_signal_connect (
 		G_OBJECT (priv->panel_applet), "change_background",
 		G_CALLBACK (panel_applet_change_background_cb), this);
+#endif
+	g_warning ("no verbs added !");
 }
 
 static GtkWidget *
@@ -592,12 +598,14 @@ create_slab_window (MainMenuUI *this)
 	slab_action_atom = gdk_atom_intern ("_SLAB_ACTION", FALSE);
 	slab_action_main_menu_atom = XInternAtom (
 		GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "_SLAB_ACTION_MAIN_MENU", FALSE);
+#ifdef MORE_PORTING
 	gdk_display_add_client_message_filter (
 		gdk_display_get_default (), slab_action_atom, slab_gdk_message_filter, this);
+#endif
 
 	g_signal_connect (
-		G_OBJECT (priv->slab_window), "expose-event",
-		G_CALLBACK (slab_window_expose_cb), this);
+		G_OBJECT (priv->slab_window), "draw",
+		G_CALLBACK (slab_window_draw_cb), this);
 
 	g_signal_connect (
 		G_OBJECT (priv->slab_window), "key-press-event",
@@ -1611,12 +1619,13 @@ grab_pointer_and_keyboard (MainMenuUI *this, guint32 time)
 		gtk_grab_add          (priv->slab_window);
 
 		status = gdk_pointer_grab (
-			priv->slab_window->window, TRUE, GDK_BUTTON_PRESS_MASK,
-			NULL, NULL, time);
+			gtk_widget_get_window (priv->slab_window), TRUE,
+			GDK_BUTTON_PRESS_MASK, NULL, NULL, time);
 
 		priv->ptr_is_grabbed = (status == GDK_GRAB_SUCCESS);
 
-		status = gdk_keyboard_grab (priv->slab_window->window, TRUE, time);
+		status = gdk_keyboard_grab (gtk_widget_get_window (priv->slab_window),
+					    TRUE, time);
 
 		priv->kbd_is_grabbed = (status == GDK_GRAB_SUCCESS);
 	}
@@ -1959,35 +1968,32 @@ panel_button_drag_data_rcv_cb (GtkWidget *widget, GdkDragContext *context, gint
 }
 
 static gboolean
-slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
+slab_window_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer user_data)
 {
 	MainMenuUIPrivate *priv = PRIVATE (user_data);
 
-	cairo_t         *cr;
+	GtkStyle *style;
+	GtkAllocation allocation, left_pane_allocation,
+		      top_pane_allocation;
 	cairo_pattern_t *gradient;
 
+/* draw window background */
 
-	cr = gdk_cairo_create (widget->window);
+	style = gtk_widget_get_style (widget);
+	gtk_widget_get_allocation (widget, &allocation);
+	gtk_widget_get_allocation (priv->top_pane, &allocation);
+	gtk_widget_get_allocation (priv->left_pane, &allocation);
 
 	cairo_rectangle (
 		cr,
-		event->area.x, event->area.y,
-		event->area.width, event->area.height);
-
-	cairo_clip (cr);
-
-/* draw window background */
-
-	cairo_rectangle (
-		cr, 
-		widget->allocation.x + 0.5, widget->allocation.y + 0.5,
-		widget->allocation.width - 1, widget->allocation.height - 1);
+		allocation.x + 0.5, allocation.y + 0.5,
+		allocation.width - 1, allocation.height - 1);
 
 	cairo_set_source_rgb (
 		cr,
-		widget->style->bg [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->bg [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->bg [GTK_STATE_ACTIVE].blue  / 65535.0);
+		style->bg [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->bg [GTK_STATE_ACTIVE].green / 65535.0,
+		style->bg [GTK_STATE_ACTIVE].blue  / 65535.0);
 
 	cairo_fill_preserve (cr);
 
@@ -1995,9 +2001,9 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
 
 	cairo_set_source_rgb (
 		cr,
-		widget->style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
+		style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].green / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
 
 	cairo_set_line_width (cr, 1.0);
 	cairo_stroke (cr);
@@ -2006,14 +2012,14 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
 
 	cairo_rectangle (
 		cr,
-		priv->left_pane->allocation.x + 0.5, priv->left_pane->allocation.y + 0.5,
-		priv->left_pane->allocation.width - 1, priv->left_pane->allocation.height - 1);
+		left_pane_allocation.x + 0.5, left_pane_allocation.y + 0.5,
+		left_pane_allocation.width - 1, left_pane_allocation.height - 1);
 
 	cairo_set_source_rgb (
 		cr,
-		widget->style->bg [GTK_STATE_NORMAL].red   / 65535.0,
-		widget->style->bg [GTK_STATE_NORMAL].green / 65535.0,
-		widget->style->bg [GTK_STATE_NORMAL].blue  / 65535.0);
+		style->bg [GTK_STATE_NORMAL].red   / 65535.0,
+		style->bg [GTK_STATE_NORMAL].green / 65535.0,
+		style->bg [GTK_STATE_NORMAL].blue  / 65535.0);
 
 	cairo_fill_preserve (cr);
 
@@ -2021,9 +2027,9 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
 
 	cairo_set_source_rgb (
 		cr,
-		widget->style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
+		style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].green / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
 
 	cairo_stroke (cr);
 
@@ -2031,19 +2037,19 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
 
 	cairo_move_to (
 		cr,
-		priv->top_pane->allocation.x + 0.5,
-		priv->top_pane->allocation.y + priv->top_pane->allocation.height - 0.5);
+		top_pane_allocation.x + 0.5,
+		top_pane_allocation.y + top_pane_allocation.height - 0.5);
 
 	cairo_line_to (
 		cr,
-		priv->top_pane->allocation.x + priv->top_pane->allocation.width - 0.5,
-		priv->top_pane->allocation.y + priv->top_pane->allocation.height - 0.5);
+		top_pane_allocation.x + top_pane_allocation.width - 0.5,
+		top_pane_allocation.y + top_pane_allocation.height - 0.5);
 
 	cairo_set_source_rgb (
 		cr,
-		widget->style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
+		style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].green / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].blue  / 65535.0);
 
 	cairo_stroke (cr);
 
@@ -2051,32 +2057,31 @@ slab_window_expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer user_d
 
 	cairo_rectangle (
 		cr,
-		priv->top_pane->allocation.x + 0.5, priv->top_pane->allocation.y + 0.5,
-		priv->top_pane->allocation.width - 1, priv->top_pane->allocation.height - 1);
+		top_pane_allocation.x + 0.5, top_pane_allocation.y + 0.5,
+		top_pane_allocation.width - 1, top_pane_allocation.height - 1);
 
 	gradient = cairo_pattern_create_linear (
-		priv->top_pane->allocation.x,
-		priv->top_pane->allocation.y,
-		priv->top_pane->allocation.x,
-		priv->top_pane->allocation.y + priv->top_pane->allocation.height);
+		top_pane_allocation.x,
+		top_pane_allocation.y,
+		top_pane_allocation.x,
+		top_pane_allocation.y + top_pane_allocation.height);
 	cairo_pattern_add_color_stop_rgba (
 		gradient, 0,
-		widget->style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].blue  / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].green / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].blue  / 65535.0,
 		0.0);
 	cairo_pattern_add_color_stop_rgba (
 		gradient, 1,
-		widget->style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].green / 65535.0,
-		widget->style->dark [GTK_STATE_ACTIVE].blue  / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].red   / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].green / 65535.0,
+		style->dark [GTK_STATE_ACTIVE].blue  / 65535.0,
 		0.2);
 
 	cairo_set_source (cr, gradient);
 	cairo_fill_preserve (cr);
 
 	cairo_pattern_destroy (gradient);
-	cairo_destroy (cr);
 
 	return FALSE;
 }
@@ -2087,14 +2092,14 @@ slab_window_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_d
 	MainMenuUIPrivate *priv = PRIVATE (user_data);
 
 	switch (event->keyval) {
-		case GDK_Super_L:
-		case GDK_Escape:
+		case GDK_KEY_Super_L:
+		case GDK_KEY_Escape:
 			gtk_toggle_button_set_active (priv->panel_button, FALSE);
 
 			return TRUE;
 
-		case GDK_W:
-		case GDK_w:
+		case GDK_KEY_W:
+		case GDK_KEY_w:
 			if (event->state & GDK_CONTROL_MASK) {
 				gtk_toggle_button_set_active (priv->panel_button, FALSE);
 
@@ -2113,11 +2118,10 @@ slab_window_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer
 	MainMenuUIPrivate *priv = PRIVATE      (this);
 
 	GdkWindow *ptr_window;
-	
-	
+
 	ptr_window = gdk_window_at_pointer (NULL, NULL);
 
-	if (priv->slab_window->window != ptr_window) {
+	if (gtk_widget_get_window (priv->slab_window) != ptr_window) {
 		hide_slab_if_urgent_close (this);
 
 		return TRUE;
@@ -2139,21 +2143,26 @@ slab_window_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_
 	GdkRectangle monitor_geom;
 
 	PanelAppletOrient orient;
+	GtkAllocation button_allocation, slab_allocation;
 
+	gtk_widget_get_allocation (GTK_WIDGET (priv->slab_window), &slab_allocation);
+	gtk_widget_get_allocation (GTK_WIDGET (priv->panel_button), &button_allocation);
 
-	gdk_window_get_origin (GTK_WIDGET (priv->panel_button)->window, & button_geom.x, & button_geom.y);
-	button_geom.width  = GTK_WIDGET (priv->panel_button)->allocation.width;
-	button_geom.height = GTK_WIDGET (priv->panel_button)->allocation.height;
+	gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (priv->panel_button)),
+			       & button_geom.x, & button_geom.y);
+	button_geom.width  = button_allocation.width;
+	button_geom.height = button_allocation.height;
 
-	slab_geom.width  = priv->slab_window->allocation.width;
-	slab_geom.height = priv->slab_window->allocation.height;
+	slab_geom.width  = slab_allocation.width;
+	slab_geom.height = slab_allocation.height;
 
 	panel_button_screen = gtk_widget_get_screen (GTK_WIDGET (priv->panel_button));
 
 	gdk_screen_get_monitor_geometry (
 		panel_button_screen,
 		gdk_screen_get_monitor_at_window (
-			panel_button_screen, GTK_WIDGET (priv->panel_button)->window),
+			panel_button_screen,
+			gtk_widget_get_window (GTK_WIDGET (priv->panel_button))),
 		& monitor_geom);
 
 	orient = panel_applet_get_orient (priv->panel_applet);
@@ -2323,15 +2332,14 @@ more_buttons_clicked_cb (GtkButton *button, gpointer user_data)
 	GTimeVal current_time;
 	guint32 current_time_millis;
 
-	GnomeDesktopItem *ditem;
-	gchar            *ditem_id;
+	GKeyFile *ditem;
+	gchar *ditem_id;
 
 	gchar *cmd_template;
 	gchar *cmd;
 	gchar *dir;
 	gchar *uri;
 
-
 	detector = DOUBLE_CLICK_DETECTOR (
 		g_object_get_data (G_OBJECT (button), "double-click-detector"));
 
@@ -2402,6 +2410,7 @@ lockdown_notify_cb (GConfClient *client, guint conn_id,
 	apply_lockdown_settings (MAIN_MENU_UI (user_data));
 }
 
+#ifdef MORE_PORTING
 static void
 panel_menu_open_cb (BonoboUIComponent *component, gpointer user_data, const gchar *verb)
 {
@@ -2437,6 +2446,7 @@ panel_menu_about_cb (BonoboUIComponent *component, gpointer user_data, const gch
 
 	gtk_window_present (GTK_WINDOW (priv->panel_about_dialog));
 }
+#endif
 
 static void
 panel_applet_change_orient_cb (PanelApplet *applet, PanelAppletOrient orient, gpointer user_data)
@@ -2444,6 +2454,7 @@ panel_applet_change_orient_cb (PanelApplet *applet, PanelAppletOrient orient, gp
 	reorient_panel_button (MAIN_MENU_UI (user_data));
 }
 
+#ifdef MORE_PORTING
 static void
 panel_applet_change_background_cb (PanelApplet *applet, PanelAppletBackgroundType type, GdkColor *color,
                                    GdkPixmap *pixmap, gpointer user_data)
@@ -2487,6 +2498,7 @@ panel_applet_change_background_cb (PanelApplet *applet, PanelAppletBackgroundTyp
 			break;
 	}
 }
+#endif
 
 static void
 slab_window_tomboy_bindkey_cb (gchar *key_string, gpointer user_data)
diff --git a/main-menu/src/main-menu.c b/main-menu/src/main-menu.c
index 25d70c6..f317ea3 100644
--- a/main-menu/src/main-menu.c
+++ b/main-menu/src/main-menu.c
@@ -23,6 +23,7 @@
 #endif
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <panel-applet.h>
 #include <string.h>
 #include <libslab/slab.h>
@@ -33,8 +34,8 @@
 
 static gboolean main_menu_applet_init (PanelApplet *, const gchar *, gpointer);
 
-PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_MainMenu_Factory", PANEL_TYPE_APPLET, "Main Menu", "0",
-	main_menu_applet_init, NULL);
+PANEL_APPLET_OUT_PROCESS_FACTORY ("GNOME_MainMenu_Factory", PANEL_TYPE_APPLET,
+				  main_menu_applet_init, NULL);
 
 #define CHECKPOINT_CONFIG_BASENAME "main-menu-checkpoint.conf"
 #define CHECKPOINT_FILE_BASENAME "main-menu"
diff --git a/main-menu/src/tile-table.c b/main-menu/src/tile-table.c
index 7c709bf..5ab0e1e 100644
--- a/main-menu/src/tile-table.c
+++ b/main-menu/src/tile-table.c
@@ -385,8 +385,8 @@ drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint t
 
 	g_object_get (G_OBJECT (widget), "n-rows", & n_rows, "n-columns", & n_cols, NULL);
 
-	bin_row = y * n_rows / widget->allocation.height;
-	bin_col = x * n_cols / widget->allocation.width;
+	bin_row = y * n_rows / gtk_widget_get_allocated_height (widget);
+	bin_col = x * n_cols / gtk_widget_get_allocated_width (widget);
 
 	bin_index = bin_row * n_cols + bin_col;
 
diff --git a/main-menu/src/tomboykeybinder.c b/main-menu/src/tomboykeybinder.c
index 7ed4da1..4568da3 100644
--- a/main-menu/src/tomboykeybinder.c
+++ b/main-menu/src/tomboykeybinder.c
@@ -81,13 +81,13 @@ grab_ungrab_with_ignorable_modifiers (GdkWindow * rootwin, Binding * binding, gb
 		if (grab)
 		{
 			XGrabKey (GDK_WINDOW_XDISPLAY (rootwin), binding->keycode,
-				binding->modifiers | mod_masks[i], GDK_WINDOW_XWINDOW (rootwin),
+				binding->modifiers | mod_masks[i], gdk_x11_window_get_xid (rootwin),
 				False, GrabModeAsync, GrabModeAsync);
 		}
 		else
 		{
 			XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin), binding->keycode,
-				binding->modifiers | mod_masks[i], GDK_WINDOW_XWINDOW (rootwin));
+				binding->modifiers | mod_masks[i], gdk_x11_window_get_xid (rootwin));
 		}
 	}
 }
@@ -291,7 +291,7 @@ tomboy_keybinder_is_modifier (guint keycode)
 	XModifierKeymap *mod_keymap;
 	gboolean retval = FALSE;
 
-	mod_keymap = XGetModifierMapping (gdk_display);
+	mod_keymap = XGetModifierMapping (gdk_x11_get_default_xdisplay());
 
 	map_size = 8 * mod_keymap->max_keypermod;
 
diff --git a/main-menu/src/trigger-panel-run-dialog.c b/main-menu/src/trigger-panel-run-dialog.c
index 721f825..0416904 100644
--- a/main-menu/src/trigger-panel-run-dialog.c
+++ b/main-menu/src/trigger-panel-run-dialog.c
@@ -9,16 +9,16 @@ run_dialog (GdkDisplay *display, GdkScreen  *screen, guint32 timestamp)
 	Atom atom;
 	Window root;
 	XClientMessageEvent ev;
-	
+
 	if (!display)
 		display = gdk_display_get_default ();
 	if (!screen)
 		screen = gdk_display_get_default_screen (display);
-	root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
-	
+	root = gdk_x11_window_get_xid (gdk_screen_get_root_window (screen));
+
 	action_atom = gdk_x11_get_xatom_by_name_for_display (display, "_GNOME_PANEL_ACTION");
 	atom = gdk_x11_get_xatom_by_name_for_display (display, "_GNOME_PANEL_ACTION_RUN_DIALOG");
-	
+
 	ev.type = ClientMessage;
 	ev.window = root;
 	ev.message_type = action_atom;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]