...
 
Commits (9)
......@@ -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;
};
......@@ -4,7 +4,7 @@
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="slab"
PKG_NAME="gnome-main-menu"
(test -f $srcdir/configure.in \
&& test -f $srcdir/autogen.sh) || {
......
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)
......
......@@ -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;
......
......@@ -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,20 +322,19 @@ tile_show_event_cb (GtkWidget * widget, gpointer user_data)
static void
open_hard_drive_tile (Tile * tile, TileEvent * event, TileAction * action)
{
GnomeDesktopItem *ditem;
SlabKeyFile *ditem;
gchar *fb_ditem_id;
fb_ditem_id = (gchar *) libslab_get_gconf_value (SYSTEM_MONITOR_GCONF_KEY);
if (! fb_ditem_id)
fb_ditem_id = g_strdup ("gnome-system-monitor.desktop");
ditem = libslab_gnome_desktop_item_new_from_unknown_id (fb_ditem_id);
ditem = slab_key_file_new_from_unknown_id (fb_ditem_id);
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);
}
......@@ -69,7 +69,7 @@ move_system_area_to_new_set ()
g_object_unref (filestream);
g_object_unref (file);
g_free (filename);
filename = g_build_filename (
g_get_user_data_dir (), PACKAGE, SYSTEM_BOOKMARK_FILENAME, NULL);
if (g_file_test (filename, G_FILE_TEST_EXISTS))
......@@ -93,7 +93,7 @@ migrate_system_gconf_to_bookmark_file ()
GList *gconf_system_list;
gint system_tile_type;
GnomeDesktopItem *ditem;
SlabKeyFile *ditem;
gchar *path;
const gchar *loc;
gchar *uri;
......@@ -163,13 +163,13 @@ migrate_system_gconf_to_bookmark_file ()
ditem = NULL;
if (system_tile_type == 0)
ditem = libslab_gnome_desktop_item_new_from_unknown_id (
ditem = slab_key_file_new_from_unknown_id (
(gchar *) libslab_get_gconf_value (HELP_ITEM_GCONF_KEY));
else if (system_tile_type == 1)
ditem = libslab_gnome_desktop_item_new_from_unknown_id (
ditem = slab_key_file_new_from_unknown_id (
(gchar *) libslab_get_gconf_value (CC_ITEM_GCONF_KEY));
else if (system_tile_type == 2)
ditem = libslab_gnome_desktop_item_new_from_unknown_id (
ditem = slab_key_file_new_from_unknown_id (
(gchar *) libslab_get_gconf_value (PM_ITEM_GCONF_KEY));
else if (system_tile_type == 3) {
screensavers = libslab_get_gconf_value (LOCKSCREEN_GCONF_KEY);
......@@ -178,35 +178,38 @@ 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 = slab_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);
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_NAME, _("Lock Screen"));
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_ICON, "gnome-lockscreen");
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_EXEC, exec_string);
slab_key_file_set_string (ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_TERMINAL, "false");
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_TYPE,
G_KEY_FILE_DESKTOP_TYPE_APPLICATION);
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_CATEGORIES, "GNOME;GTK;");
slab_key_file_set_string (
ditem, G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, "GNOME;");
slab_key_file_save (ditem, path);
g_free (path);
break;
}
......@@ -220,12 +223,12 @@ migrate_system_gconf_to_bookmark_file ()
g_list_free (screensavers);
}
else if (system_tile_type == 4)
ditem = libslab_gnome_desktop_item_new_from_unknown_id (LOGOUT_DESKTOP_ITEM);
ditem = slab_key_file_new_from_unknown_id (LOGOUT_DESKTOP_ITEM);
else
ditem = NULL;
if (ditem) {
loc = gnome_desktop_item_get_location (ditem);
loc = slab_key_file_get_location (ditem);
if (g_path_is_absolute (loc))
uri = g_filename_to_uri (loc, NULL, NULL);
......@@ -239,10 +242,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));
slab_key_file_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_NAME),
slab_key_file_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_EXEC));
name = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_NAME);
name = slab_key_file_get (ditem, G_KEY_FILE_DESKTOP_KEY_NAME);
if (! strcmp (name, "Yelp"))
g_bookmark_file_set_title (bm_file, uri, _("Help"));
......@@ -255,7 +258,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 +286,7 @@ migrate_user_apps_gconf_to_bookmark_file ()
GList *user_apps_list;
GnomeDesktopItem *ditem;
SlabKeyFile *ditem;
const gchar *loc;
gchar *uri;
......@@ -311,10 +314,10 @@ migrate_user_apps_gconf_to_bookmark_file ()
bm_file = g_bookmark_file_new ();
for (node = user_apps_list; node; node = node->next) {
ditem = libslab_gnome_desktop_item_new_from_unknown_id ((gchar *) node->data);
ditem = slab_key_file_new_from_unknown_id ((gchar *) node->data);
if (ditem) {
loc = gnome_desktop_item_get_location (ditem);
loc = slab_key_file_get_location (ditem);
if (g_path_is_absolute (loc))
uri = g_filename_to_uri (loc, NULL, NULL);
......@@ -328,14 +331,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));
slab_key_file_get_locale (ditem, G_KEY_FILE_DESKTOP_KEY_NAME),
slab_key_file_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);
}
......
......@@ -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,6 +220,7 @@ 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),
......@@ -237,6 +239,7 @@ static const gchar *main_menu_artists [] = {
"Jakub Steiner <jimmac@novell.com>",
NULL
};
#endif
enum {
APPS_PAGE,
......@@ -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",
......@@ -1101,42 +1109,6 @@ item_to_recent_doc_tile (BookmarkItem *item, gpointer data)
{
MainMenuUIPrivate *priv = PRIVATE (data);
GMount *mount;
GVolume *volume;
GFile *file;
char *nfs_id;
gboolean is_nfs = FALSE;
gboolean is_local = TRUE;
GList *node;
/* we no longer do our own thumbnailing so this "should" not hang on stale mounts, slow endpoints ... */
/*
if (! g_str_has_prefix (item->uri, "file://"))
return NULL;
for (node = priv->mounts; ! is_nfs && node; node = node->next) {
mount = node->data;
volume = g_mount_get_volume (mount); //need to check for null here
nfs_id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT);
is_nfs = (nfs_id != NULL);
g_free (nfs_id);
g_object_unref (volume);
}
if (is_nfs)
return NULL;
file = g_file_new_for_uri (item->uri);
is_local = g_file_is_native (file);
g_object_unref (file);
if (! is_local)
return NULL;
*/
if (bookmark_agent_has_item (priv->bm_agents [BOOKMARK_STORE_USER_DOCS], item->uri))
return NULL;
......@@ -1153,33 +1125,15 @@ static Tile *
item_to_system_tile (BookmarkItem *item, gpointer data)
{
Tile *tile;
gchar *basename;
gchar *translated_title;
if (app_is_in_blacklist (item->uri))
return NULL;
translated_title = item->title ? _(item->title) : NULL;
tile = TILE (system_tile_new (item->uri, translated_title));
/* with 0.9.12 we start with clean system area - see move_system_area_to_new_set
no longer need this code to clean up old junk
if (tile)
return tile;
basename = g_strrstr (item->uri, "/");
if (basename)
basename++;
else
basename = item->uri;
if (! libslab_strcmp (basename, "control-center.desktop"))
tile = TILE (system_tile_new ("gnomecc.desktop", translated_title));
else if (! libslab_strcmp (basename, "zen-installer.desktop"))
tile = TILE (system_tile_new ("package-manager.desktop", translated_title));
*/
return tile;
}
......@@ -1255,20 +1209,20 @@ app_is_in_blacklist (const gchar *uri)
disable_term = GPOINTER_TO_INT (libslab_get_gconf_value (DISABLE_TERMINAL_GCONF_KEY));
blacklisted = disable_term && libslab_desktop_item_is_a_terminal (uri);
blacklisted = disable_term && slab_key_file_is_a_terminal (uri);
if (blacklisted)
return TRUE;
disable_logout = GPOINTER_TO_INT (libslab_get_gconf_value (DISABLE_LOGOUT_GCONF_KEY));
blacklisted = disable_logout && libslab_desktop_item_is_logout (uri);
blacklisted = disable_logout && slab_key_file_is_logout (uri);
if (blacklisted)
return TRUE;
disable_lockscreen = GPOINTER_TO_INT (libslab_get_gconf_value (DISABLE_LOCKSCREEN_GCONF_KEY));
/* Dont allow lock screen if root - same as gnome-panel */
blacklisted = libslab_desktop_item_is_lockscreen (uri) &&
blacklisted = slab_key_file_is_lockscreen (uri) &&
( (geteuid () == 0) || disable_lockscreen );
if (blacklisted)
......@@ -1611,12 +1565,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 +1914,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, &top_pane_allocation);
gtk_widget_get_allocation (priv->left_pane, &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 +1947,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 +1958,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 +1973,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 +1983,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 +2003,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 +2038,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 +2064,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 +2089,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 +2278,14 @@ more_buttons_clicked_cb (GtkButton *button, gpointer user_data)
GTimeVal current_time;
guint32 current_time_millis;
GnomeDesktopItem *ditem;
gchar *ditem_id;
SlabKeyFile *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"));
......@@ -2371,10 +2325,10 @@ more_buttons_clicked_cb (GtkButton *button, gpointer user_data)
else
ditem_id = libslab_get_gconf_value (FILE_BROWSER_GCONF_KEY);
ditem = libslab_gnome_desktop_item_new_from_unknown_id (ditem_id);
ditem = slab_key_file_new_from_unknown_id (ditem_id);
if (ditem) {
libslab_gnome_desktop_item_launch_default (ditem);
slab_key_file_launch_default (ditem);
hide_slab_if_urgent_close (this);
}
......@@ -2402,6 +2356,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)
{
......@@ -2487,6 +2442,7 @@ panel_applet_change_background_cb (PanelApplet *applet, PanelAppletBackgroundTyp
break;
}
}
#endif
static void
slab_window_tomboy_bindkey_cb (gchar *key_string, gpointer user_data)
......
......@@ -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,9 @@
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, /* FIXME: our gobject type ? */
main_menu_applet_init, NULL);
#define CHECKPOINT_CONFIG_BASENAME "main-menu-checkpoint.conf"
#define CHECKPOINT_FILE_BASENAME "main-menu"
......@@ -47,9 +49,6 @@ main_menu_applet_init (PanelApplet *applet, const gchar *iid, gpointer user_data
libslab_checkpoint ("Main-menu starts up");
if (strcmp (iid, "OAFIID:GNOME_MainMenu") != 0)
return FALSE;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
......
......@@ -449,5 +449,5 @@ launch_network_config (const gchar * desktop_key)
if (!open_desktop_item_exec (desktop_item))
g_warning ("network_status_tile_open: couldn't exec item\n");
gnome_desktop_item_unref (desktop_item);
slab_key_file_unref (desktop_item);
}
......@@ -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;
......
......@@ -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;
......
......@@ -9,28 +9,28 @@ 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;
ev.format = 32;
ev.data.l[0] = atom;
ev.data.l[1] = timestamp;
gdk_error_trap_push ();
XSendEvent (gdk_x11_display_get_xdisplay (display),
root, False, StructureNotifyMask, (XEvent*) &ev);
gdk_flush ();
gdk_error_trap_pop ();
}
......@@ -40,7 +40,7 @@ main (int argc, char **argv)
{
gint lastentry = 0;
guint32 timestamp;
const gchar* startup_id = g_getenv ("DESKTOP_STARTUP_ID");
//printf ("startup id is %s\n", startup_id);
if (startup_id && (startup_id[0] != '\0'))
......