[Xfce4-commits] r25079 - in xfce4-panel/trunk: . panel
Nick Schermer
nick at xfce.org
Sat Mar 3 20:54:23 CET 2007
Author: nick
Date: 2007-03-03 19:54:22 +0000 (Sat, 03 Mar 2007)
New Revision: 25079
Modified:
xfce4-panel/trunk/ChangeLog
xfce4-panel/trunk/panel/frap-icon-entry.c
xfce4-panel/trunk/panel/frap-icon-entry.h
xfce4-panel/trunk/panel/panel-app-messages.c
xfce4-panel/trunk/panel/panel-app-messages.h
xfce4-panel/trunk/panel/panel-app.c
xfce4-panel/trunk/panel/panel-app.h
xfce4-panel/trunk/panel/panel-config.c
xfce4-panel/trunk/panel/panel-config.h
xfce4-panel/trunk/panel/panel-dialogs.c
xfce4-panel/trunk/panel/panel-dialogs.h
xfce4-panel/trunk/panel/panel-dnd.c
xfce4-panel/trunk/panel/panel-dnd.h
xfce4-panel/trunk/panel/panel-item-manager.c
xfce4-panel/trunk/panel/panel-item-manager.h
xfce4-panel/trunk/panel/panel-private.h
xfce4-panel/trunk/panel/panel-properties.c
xfce4-panel/trunk/panel/panel-properties.h
Log:
* panel/*: Import all the code from my branch to trunk. Only the main.c
file is different in the branch because it contains a problem that
causes Xfce to start very slowly (the session manager).
Modified: xfce4-panel/trunk/ChangeLog
===================================================================
--- xfce4-panel/trunk/ChangeLog 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/ChangeLog 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,5 +1,11 @@
2007-03-03 21:00 nick
+ * panel/*: Import all the code from my branch to trunk. Only the main.c
+ file is different in the branch because it contains a problem that
+ causes Xfce to start very slowly (the session manager).
+
+2007-03-03 21:00 nick
+
* Import my 4_5_nick branch into trunk:
- Completely rewritten launcher (Bugs 2336, 2365, 1323, 2262 and 1225)
- Various improvements in libxfce4panel (memory leaks, G_GNUC_INTERNAL,
Modified: xfce4-panel/trunk/panel/frap-icon-entry.c
===================================================================
--- xfce4-panel/trunk/panel/frap-icon-entry.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/frap-icon-entry.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,5 +1,5 @@
-/* $Id$ */
-/*-
+/* $Id$
+ *
* Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
Modified: xfce4-panel/trunk/panel/frap-icon-entry.h
===================================================================
--- xfce4-panel/trunk/panel/frap-icon-entry.h 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/frap-icon-entry.h 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,5 +1,5 @@
-/* $Id$ */
-/*-
+/* $Id$
+ *
* Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
GdkWindow *icon_area;
FrapIconEntryPrivate *priv;
};
-
+
GType frap_icon_entry_get_type (void) G_GNUC_CONST;
GtkWidget *frap_icon_entry_new (void) G_GNUC_MALLOC;
Modified: xfce4-panel/trunk/panel/panel-app-messages.c
===================================================================
--- xfce4-panel/trunk/panel/panel-app-messages.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-app-messages.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,29 +1,29 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
#include <X11/Xlib.h>
#include <gtk/gtk.h>
@@ -41,11 +41,11 @@
/* client messages */
static gboolean
-client_event_received (GtkWidget *win,
+client_event_received (GtkWidget *win,
GdkEventClient *ev)
{
GdkAtom atom = gdk_atom_intern (PANEL_APP_ATOM, FALSE);
-
+
if (ev->message_type == atom)
{
switch (ev->data.s[0])
@@ -68,9 +68,6 @@
case PANEL_APP_ADD:
panel_app_customize_items (NULL);
break;
- case PANEL_APP_ABOUT:
- panel_app_about (win);
- break;
default:
return FALSE;
}
@@ -93,34 +90,33 @@
panel_app_send (PanelAppMessage message)
{
Window win;
-
+ GdkEventClient gev;
+ GtkWidget *invisible;
+
if (panel_app_init () != 1)
{
g_warning ("xfce4-panel is not running");
return;
}
-
+
win = panel_app_get_ipc_window ();
if (win)
{
- GdkEventClient gev;
- GtkWidget *invisible;
-
invisible = gtk_invisible_new ();
gtk_widget_realize (invisible);
-
- gev.type = GDK_CLIENT_EVENT;
- gev.window = invisible->window;
- gev.send_event = TRUE;
- gev.message_type = gdk_atom_intern (PANEL_APP_ATOM, FALSE);
- gev.data_format = 16;
+
+ gev.type = GDK_CLIENT_EVENT;
+ gev.window = invisible->window;
+ gev.send_event = TRUE;
+ gev.message_type = gdk_atom_intern (PANEL_APP_ATOM, FALSE);
+ gev.data_format = 16;
gev.data.s[0] = message;
gev.data.s[1] = 0;
- gdk_event_send_client_message ((GdkEvent *) & gev,
- (GdkNativeWindow) win);
- gdk_flush ();
+ gdk_event_send_client_message ((GdkEvent *) & gev,
+ (GdkNativeWindow) win);
+ gdk_flush ();
gtk_widget_destroy (invisible);
}
@@ -135,7 +131,7 @@
void
panel_app_listen (GtkWidget *ipc_window)
{
- g_signal_connect (ipc_window, "client-event",
+ g_signal_connect (G_OBJECT (ipc_window), "client-event",
G_CALLBACK (client_event_received), NULL);
}
Modified: xfce4-panel/trunk/panel/panel-app-messages.h
===================================================================
--- xfce4-panel/trunk/panel/panel-app-messages.h 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-app-messages.h 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,26 +1,24 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _PANEL_APP_MESSAGES_H
-#define _PANEL_APP_MESSAGES_H
+#ifndef __PANEL_APP_MESSAGES_H__
+#define __PANEL_APP_MESSAGES_H__
#include <gtk/gtkwidget.h>
@@ -33,8 +31,7 @@
PANEL_APP_RESTART,
PANEL_APP_QUIT,
PANEL_APP_EXIT,
- PANEL_APP_ADD,
- PANEL_APP_ABOUT
+ PANEL_APP_ADD
}
PanelAppMessage;
@@ -44,4 +41,4 @@
G_END_DECLS
-#endif /* _PANEL_APP_MESSAGES_H */
+#endif /* !__PANEL_APP_MESSAGES_H__ */
Modified: xfce4-panel/trunk/panel/panel-app.c
===================================================================
--- xfce4-panel/trunk/panel/panel-app.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-app.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,36 +1,50 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005-2006 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <stdio.h>
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#endif
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
+#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
#include <errno.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <X11/Xlib.h>
#include <gtk/gtk.h>
@@ -60,20 +74,20 @@
#if defined(TIMER) && defined(G_HAVE_ISO_VARARGS)
void
-xfce_panel_program_log (const char *file,
- const int line,
- const char *format,
+xfce_panel_program_log (const gchar *file,
+ const gint line,
+ const gchar *format,
...)
{
- va_list args;
- gchar *formatted;
- gchar *message;
+ va_list args;
+ gchar *formatted;
+ gchar *message;
va_start (args, format);
formatted = g_strdup_vprintf (format, args);
va_end (args);
- message = g_strdup_printf ("MARK: %s: %s:%d: %s",
+ message = g_strdup_printf ("MARK: %s: %s:%d: %s",
g_get_prgname(), file, line, formatted);
access (message, F_OK);
@@ -107,20 +121,21 @@
GPtrArray *panel_list;
GPtrArray *monitor_list;
- int save_id;
- int current_panel;
+ gint save_id;
+ gint current_panel;
+
GList *dialogs;
/* Initialization. Also unset before cleanup. */
- guint initialized:1;
+ guint initialized : 1;
/* Check whether monitors in Xinerama are aligned. */
- guint xinerama_and_equal_width:1;
- guint xinerama_and_equal_height:1;
+ guint xinerama_and_equal_width : 1;
+ guint xinerama_and_equal_height : 1;
};
static PanelApp panel_app = {0};
-static int signal_pipe[2];
+static gint signal_pipe[2];
/* cleanup */
@@ -128,8 +143,10 @@
static void
cleanup_panels (void)
{
- int i;
- GList *l;
+ gint i;
+ GList *l;
+ Panel *panel;
+ XfceMonitor *xmon;
if (!panel_app.initialized)
return;
@@ -138,7 +155,7 @@
l = panel_app.dialogs;
panel_app.dialogs = NULL;
-
+
while (l)
{
gtk_dialog_response (GTK_DIALOG (l->data), GTK_RESPONSE_NONE);
@@ -147,7 +164,7 @@
for (i = 0; i < panel_app.panel_list->len; ++i)
{
- Panel *panel = g_ptr_array_index (panel_app.panel_list, i);
+ panel = g_ptr_array_index (panel_app.panel_list, i);
gtk_widget_hide (GTK_WIDGET (panel));
@@ -162,7 +179,7 @@
for (i = 0; i < panel_app.monitor_list->len; ++i)
{
- XfceMonitor *xmon = g_ptr_array_index (panel_app.monitor_list, i);
+ xmon = g_ptr_array_index (panel_app.monitor_list, i);
panel_slice_free (XfceMonitor, xmon);
}
g_ptr_array_free (panel_app.monitor_list, TRUE);
@@ -172,9 +189,9 @@
/** copied from glibc manual, does this prevent zombies? */
static void
-sigchld_handler (int sig)
+sigchld_handler (gint sig)
{
- int pid, status, serrno;
+ gint pid, status, serrno;
serrno = errno;
@@ -190,7 +207,7 @@
}
static void
-sighandler (int sig)
+sighandler (gint sig)
{
/* Don't do any real stuff here.
* Only set a signal state flag. There's a timeout in the main loop
@@ -206,16 +223,16 @@
static gboolean
check_run_state (void)
{
- static int recursive = 0;
- gboolean quit = FALSE;
-
+ static gint recursive = 0;
+ gboolean quit = FALSE;
+
/* micro-optimization */
if (G_LIKELY (panel_app.runstate == PANEL_RUN_STATE_NORMAL))
return TRUE;
-
+
if (G_UNLIKELY (recursive))
return TRUE;
-
+
recursive++;
switch (panel_app.runstate)
@@ -241,7 +258,7 @@
panel_app_save ();
quit = TRUE;
}
-
+
/* don't forget to set back the run state */
panel_app.runstate = PANEL_RUN_STATE_NORMAL;
break;
@@ -265,21 +282,21 @@
}
static gboolean
-set_run_state (GIOChannel *source,
- GIOCondition cond,
+set_run_state (GIOChannel *source,
+ GIOCondition cond,
gpointer data)
{
GError *error = NULL;
GIOStatus status;
gsize bytes_read;
- /*
+ /*
* There is no g_io_channel_read or g_io_channel_read_int, so we read
* char's and use a union to recover the unix signal number.
*/
union
{
- gchar chars[sizeof (int)];
- int signal;
+ gchar chars[sizeof (gint)];
+ gint signal;
} buf;
while ((status = g_io_channel_read_chars (source, buf.chars, sizeof (int),
@@ -337,10 +354,10 @@
/* session */
static void
-session_save_yourself (gpointer data,
- int save_style,
+session_save_yourself (gpointer data,
+ gint save_style,
gboolean shutdown,
- int interact_style,
+ gint interact_style,
gboolean fast)
{
panel_app_save ();
@@ -356,7 +373,7 @@
static void
monitor_size_changed (GdkScreen *screen)
{
- int i;
+ gint i;
XfceMonitor *monitor;
GtkWidget *panel;
@@ -366,7 +383,7 @@
if (monitor->screen == screen)
{
- gdk_screen_get_monitor_geometry (screen, monitor->num,
+ gdk_screen_get_monitor_geometry (screen, monitor->num,
&(monitor->geometry));
}
}
@@ -386,12 +403,13 @@
GdkDisplay *display;
GdkScreen *screen;
XfceMonitor *monitor;
- int n_screens;
- int n_monitors = 0;
- int i, j;
- int w = 0, h = 0;
+ gint n_screens;
+ gint n_monitors = 0;
+ gint i, j;
+ gint w = 0, h = 0;
gboolean equal_w, equal_h;
-
+ XfceMonitor *mon1, *mon2;
+
panel_app.monitor_list = g_ptr_array_new ();
display = gdk_display_get_default ();
@@ -399,7 +417,7 @@
n_screens = gdk_display_get_n_screens (display);
equal_w = equal_h = TRUE;
-
+
for (i = 0; i < n_screens; ++i)
{
screen = gdk_display_get_screen (display, i);
@@ -416,7 +434,7 @@
gdk_screen_get_monitor_geometry (screen, j, &(monitor->geometry));
g_ptr_array_add (panel_app.monitor_list, monitor);
-
+
if (j > 0)
{
if (w != monitor->geometry.width)
@@ -427,7 +445,7 @@
w = monitor->geometry.width;
h = monitor->geometry.height;
-
+
#if TEST_MULTIPLE_MONITORS
monitor = panel_slice_new0 (XfceMonitor);
@@ -440,7 +458,7 @@
#endif
}
- g_signal_connect (screen, "size-changed",
+ g_signal_connect (G_OBJECT (screen), "size-changed",
G_CALLBACK (monitor_size_changed), NULL);
}
@@ -453,8 +471,6 @@
/* check layout */
for (i = 0; i < panel_app.monitor_list->len; ++i)
{
- XfceMonitor *mon1, *mon2;
-
mon1 = g_ptr_array_index (panel_app.monitor_list, i);
for (j = 0; j < panel_app.monitor_list->len; ++j)
@@ -523,23 +539,23 @@
* Initialize application. Creates ipc window if no other instance is
* running or sets the ipc window from the running instance.
*
- * Returns: 0 on success, 1 when an xfce4-panel instance already exists,
+ * Returns: 0 on success, 1 when an xfce4-panel instance already exists,
* and -1 on failure.
**/
int
panel_app_init (void)
{
- Atom selection_atom;
- Atom manager_atom;
+ Atom selection_atom, manager_atom;
GtkWidget *invisible;
XClientMessageEvent xev;
if (panel_app.initialized)
return 0;
-
+
panel_app.initialized = TRUE;
-
+
selection_atom = XInternAtom (GDK_DISPLAY (), SELECTION_NAME, False);
+
panel_app.ipc_window = XGetSelectionOwner (GDK_DISPLAY (), selection_atom);
if (panel_app.ipc_window)
@@ -547,25 +563,25 @@
invisible = gtk_invisible_new ();
gtk_widget_realize (invisible);
-
+
panel_app.gtk_ipc_window = invisible;
panel_app.ipc_window = GDK_WINDOW_XWINDOW (invisible->window);
-
+
XSelectInput (GDK_DISPLAY (), panel_app.ipc_window, PropertyChangeMask);
-
- XSetSelectionOwner (GDK_DISPLAY (), selection_atom, panel_app.ipc_window,
+
+ XSetSelectionOwner (GDK_DISPLAY (), selection_atom, panel_app.ipc_window,
GDK_CURRENT_TIME);
-
- if (XGetSelectionOwner (GDK_DISPLAY (), selection_atom) !=
+
+ if (XGetSelectionOwner (GDK_DISPLAY (), selection_atom) !=
panel_app.ipc_window)
{
g_critical ("Could not set ownership of selection \"%s\"",
SELECTION_NAME);
return -1;
}
-
+
manager_atom = XInternAtom (GDK_DISPLAY (), "MANAGER", False);
-
+
xev.type = ClientMessage;
xev.window = GDK_ROOT_WINDOW ();
xev.message_type = manager_atom;
@@ -573,8 +589,8 @@
xev.data.l[0] = GDK_CURRENT_TIME;
xev.data.l[1] = selection_atom;
xev.data.l[2] = panel_app.ipc_window;
- xev.data.l[3] = 0; /* manager specific data */
- xev.data.l[4] = 0; /* manager specific data */
+ xev.data.l[3] = 0; /* manager specific data */
+ xev.data.l[4] = 0; /* manager specific data */
XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), False,
StructureNotifyMask, (XEvent *) & xev);
@@ -604,26 +620,26 @@
TIMER_ELAPSED(" + end show panel");
g_idle_add ((GSourceFunc)expose_timeout, panel);
TIMER_ELAPSED("end panel_app_init_panel");
-}
+}
/**
* panel_app_run
- *
+ *
* Run the panel application. Reads the configuration file(s) and sets up the
* panels, before turning over control to the main event loop.
*
* Returns: 1 to restart and 0 to quit.
**/
-int
-panel_app_run (int argc,
- char **argv)
+gint
+panel_app_run (gint argc,
+ gchar **argv)
{
#ifdef HAVE_SIGACTION
struct sigaction act;
-#endif
+#endif
GIOChannel *g_signal_in;
GError *error = NULL;
- long fd_flags;
+ glong fd_flags;
/* create pipe and set writing end in non-blocking mode */
if (pipe (signal_pipe))
@@ -677,19 +693,19 @@
#else
act.sa_flags = 0;
#endif
- sigaction (SIGHUP, &act, NULL);
+ sigaction (SIGHUP, &act, NULL);
sigaction (SIGUSR1, &act, NULL);
sigaction (SIGUSR2, &act, NULL);
- sigaction (SIGINT, &act, NULL);
+ sigaction (SIGINT, &act, NULL);
sigaction (SIGABRT, &act, NULL);
sigaction (SIGTERM, &act, NULL);
act.sa_handler = sigchld_handler;
sigaction (SIGCHLD, &act, NULL);
#else
- signal (SIGHUP, sighandler);
+ signal (SIGHUP, sighandler);
signal (SIGUSR1, sighandler);
signal (SIGUSR2, sighandler);
- signal (SIGINT, sighandler);
+ signal (SIGINT, sighandler);
signal (SIGABRT, sighandler);
signal (SIGTERM, sighandler);
signal (SIGCHLD, sigchld_handler);
@@ -697,27 +713,27 @@
/* environment */
xfce_setenv ("DISPLAY", gdk_display_get_name (gdk_display_get_default ()),
- TRUE);
-
+ TRUE);
+
/* session management */
- panel_app.session_client =
- client_session_new (argc, argv, NULL /* data */,
+ panel_app.session_client =
+ client_session_new (argc, argv, NULL /* data */,
SESSION_RESTART_IF_RUNNING, 40);
panel_app.session_client->save_yourself = session_save_yourself;
- panel_app.session_client->die = session_die;
+ panel_app.session_client->die = session_die;
TIMER_ELAPSED("connect to session manager");
if (!session_init (panel_app.session_client))
{
g_free (panel_app.session_client);
panel_app.session_client = NULL;
- }
-
+ }
+
/* screen layout and geometry */
TIMER_ELAPSED("start monitor list creation");
create_monitor_list ();
-
+
/* configuration */
TIMER_ELAPSED("start init item manager");
xfce_panel_item_manager_init ();
@@ -726,14 +742,14 @@
panel_app.panel_list = panel_config_create_panels ();
TIMER_ELAPSED("end panel creation");
- g_ptr_array_foreach (panel_app.panel_list, (GFunc)panel_app_init_panel,
+ g_ptr_array_foreach (panel_app.panel_list, (GFunc)panel_app_init_panel,
NULL);
/* Run Forrest, Run! */
panel_app.runstate = PANEL_RUN_STATE_NORMAL;
TIMER_ELAPSED("start main loop");
gtk_main ();
-
+
/* cleanup */
g_free (panel_app.session_client);
panel_app.session_client = NULL;
@@ -751,7 +767,7 @@
save_timeout (void)
{
DBG (" ++ save timeout");
-
+
if (panel_app.save_id)
g_source_remove (panel_app.save_id);
panel_app.save_id = 0;
@@ -765,7 +781,7 @@
return FALSE;
}
-void
+void
panel_app_queue_save (void)
{
if (!panel_app.initialized)
@@ -774,26 +790,26 @@
if (panel_app.runstate == PANEL_RUN_STATE_NORMAL)
{
if (!panel_app.save_id)
- panel_app.save_id =
+ panel_app.save_id =
g_timeout_add (SAVE_TIMEOUT, (GSourceFunc)save_timeout, NULL);
}
}
-void
+void
panel_app_customize (void)
{
if (xfce_allow_panel_customization())
panel_manager_dialog (panel_app.panel_list);
}
-void
+void
panel_app_customize_items (GtkWidget *active_item)
{
if (xfce_allow_panel_customization())
add_items_dialog (panel_app.panel_list, active_item);
}
-void
+void
panel_app_save (void)
{
if (!panel_app.initialized)
@@ -803,35 +819,35 @@
panel_config_save_panels (panel_app.panel_list);
}
-void
+void
panel_app_restart (void)
{
panel_app.runstate = PANEL_RUN_STATE_RESTART;
check_run_state ();
}
-void
+void
panel_app_quit (void)
{
panel_app.runstate = PANEL_RUN_STATE_QUIT;
check_run_state ();
}
-void
+void
panel_app_quit_noconfirm (void)
{
panel_app.runstate = PANEL_RUN_STATE_QUIT_NOCONFIRM;
check_run_state ();
}
-void
+void
panel_app_quit_nosave (void)
{
panel_app.runstate = PANEL_RUN_STATE_QUIT_NOSAVE;
check_run_state ();
}
-void
+void
panel_app_add_panel (void)
{
Panel *panel;
@@ -843,7 +859,7 @@
if (G_UNLIKELY (panel_app.panel_list == NULL))
panel_app.panel_list = g_ptr_array_sized_new (1);
-
+
g_ptr_array_add (panel_app.panel_list, panel);
panel_set_screen_position (panel, XFCE_SCREEN_POSITION_FLOATING_H);
@@ -858,22 +874,22 @@
panel_app_customize ();
}
-void
+void
panel_app_remove_panel (GtkWidget *panel)
{
- int response = GTK_RESPONSE_NONE;
- int n;
- char *first;
+ gint response = GTK_RESPONSE_NONE;
+ gint n;
+ gchar *first;
if (!xfce_allow_panel_customization())
return;
-
+
if (panel_app.panel_list->len == 1)
{
- response =
+ response =
xfce_message_dialog (NULL, _("Xfce Panel"),
- GTK_STOCK_DIALOG_WARNING,
- _("Exit Xfce Panel?"),
+ GTK_STOCK_DIALOG_WARNING,
+ _("Exit Xfce Panel?"),
_("You can't remove the last panel. "
"Would you like to exit the program?"),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -885,7 +901,7 @@
return;
}
-
+
for (n = 0; n < panel_app.panel_list->len; ++n)
{
if (panel == g_ptr_array_index (panel_app.panel_list, n))
@@ -894,24 +910,24 @@
if (n == panel_app.panel_list->len)
return;
-
+
panel_block_autohide (PANEL (panel));
-
+
panel_set_items_sensitive (PANEL (panel), FALSE);
gtk_widget_set_sensitive (panel, FALSE);
gtk_drag_highlight (panel);
-
+
first = g_strdup_printf (_("Remove Panel \"%d\"?"), n + 1);
-
+
response = xfce_message_dialog (GTK_WINDOW (panel), _("Xfce Panel"),
- GTK_STOCK_DIALOG_WARNING, first,
+ GTK_STOCK_DIALOG_WARNING, first,
_("The selected panel and all its items "
"will be removed."),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_REMOVE, GTK_RESPONSE_ACCEPT,
NULL);
g_free (first);
-
+
if (response != GTK_RESPONSE_ACCEPT)
{
gtk_drag_unhighlight (panel);
@@ -929,36 +945,34 @@
}
}
-void
+void
panel_app_about (GtkWidget *panel)
{
XfceAboutInfo *info;
GtkWidget *dlg;
GdkPixbuf *pb;
- info =
- xfce_about_info_new (_("Xfce Panel"), "", _("Xfce Panel"),
- XFCE_COPYRIGHT_TEXT ("2006", "Jasper Huijsmans"),
- XFCE_LICENSE_GPL);
+ info = xfce_about_info_new (_("Xfce Panel"), "", _("Xfce Panel"),
+ XFCE_COPYRIGHT_TEXT ("2006", "Jasper Huijsmans"),
+ XFCE_LICENSE_GPL);
xfce_about_info_set_homepage (info, "http://www.xfce.org");
- xfce_about_info_add_credit (info, "Jasper Huijsmans", "jasper at xfce.org",
- _("Developer"));
+ xfce_about_info_add_credit (info, "Jasper Huijsmans", "jasper at xfce.org", _("Developer"));
+ xfce_about_info_add_credit (info, "Nick Schermer", "nick at xfce.org", _("Developer"));
- xfce_about_info_add_credit (info, "Nick Schermer", "nick at xfce.org",
- _("Developer"));
-
pb = xfce_themed_icon_load ("xfce4-panel", 48);
dlg = xfce_about_dialog_new_with_values (NULL, info, pb);
g_object_unref (G_OBJECT (pb));
gtk_window_set_screen (GTK_WINDOW (dlg), gtk_widget_get_screen (panel));
+
gtk_widget_set_size_request (dlg, 400, 300);
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
+
xfce_about_info_free (info);
}
@@ -971,37 +985,38 @@
}
XfceMonitor *
-panel_app_get_monitor (int n)
+panel_app_get_monitor (gint n)
{
- return g_ptr_array_index (panel_app.monitor_list,
+ return g_ptr_array_index (panel_app.monitor_list,
CLAMP (n, 0, panel_app.monitor_list->len - 1));
}
-int
+gint
panel_app_get_n_monitors (void)
{
return panel_app.monitor_list->len;
}
/* open dialogs */
-void
+void
panel_app_register_dialog (GtkWidget *dialog)
{
g_return_if_fail (GTK_IS_WIDGET (dialog));
- g_signal_connect (dialog, "destroy", G_CALLBACK (unregister_dialog), NULL);
+ g_signal_connect (G_OBJECT (dialog), "destroy",
+ G_CALLBACK (unregister_dialog), NULL);
panel_app.dialogs = g_list_prepend (panel_app.dialogs, dialog);
}
/* current panel */
-void
+void
panel_app_set_current_panel (gpointer *panel)
{
- int i;
+ gint i;
panel_app.current_panel = 0;
-
+
for (i = 0; i < panel_app.panel_list->len; ++i)
{
if (g_ptr_array_index (panel_app.panel_list, i) == panel)
@@ -1014,10 +1029,10 @@
DBG ("Current panel: %d", panel_app.current_panel);
}
-void
+void
panel_app_unset_current_panel (gpointer *panel)
{
- int i;
+ gint i;
for (i = 0; i < panel_app.panel_list->len; ++i)
{
@@ -1032,13 +1047,13 @@
DBG ("Current panel: %d", panel_app.current_panel);
}
-int
+gint
panel_app_get_current_panel (void)
{
return panel_app.current_panel;
}
-G_CONST_RETURN GPtrArray *
+const GPtrArray *
panel_app_get_panel_list (void)
{
return panel_app.panel_list;
Modified: xfce4-panel/trunk/panel/panel-app.h
===================================================================
--- xfce4-panel/trunk/panel/panel-app.h 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-app.h 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,32 +1,34 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _PANEL_APP_H
-#define _PANEL_APP_H
+#ifndef __PANEL_APP_H__
+#define __PANEL_APP_H__
#include <X11/Xlib.h>
#include <gtk/gtkwidget.h>
+G_BEGIN_DECLS
+
+typedef struct _XfceMonitor XfceMonitor;
+
#if defined(TIMER) && defined(G_HAVE_ISO_VARARGS)
-void xfce_panel_program_log (const char *file, const int line,
+void xfce_panel_program_log (const char *file, const int line,
const char *format, ...);
#define TIMER_ELAPSED(...) \
@@ -38,19 +40,17 @@
#endif /* TIMER */
-G_BEGIN_DECLS
-typedef struct _XfceMonitor XfceMonitor;
struct _XfceMonitor
{
- GdkScreen *screen;
- int num;
- GdkRectangle geometry;
- guint has_neighbor_left:1;
- guint has_neighbor_right:1;
- guint has_neighbor_above:1;
- guint has_neighbor_below:1;
+ GdkScreen *screen;
+ gint num;
+ GdkRectangle geometry;
+ guint has_neighbor_left : 1;
+ guint has_neighbor_right : 1;
+ guint has_neighbor_above : 1;
+ guint has_neighbor_below : 1;
};
/* run control */
@@ -105,9 +105,9 @@
int panel_app_get_current_panel (void);
/* get panel list */
-G_CONST_RETURN GPtrArray *panel_app_get_panel_list (void);
+const GPtrArray *panel_app_get_panel_list (void);
G_END_DECLS
-#endif /* _PANEL_APP_H */
+#endif /* !__PANEL_APP_H__ */
Modified: xfce4-panel/trunk/panel/panel-config.c
===================================================================
--- xfce4-panel/trunk/panel/panel-config.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-config.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,42 +1,59 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDIO_H
#include <stdio.h>
+#endif
+#ifdef HAVE_ERRNO_H
#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#include <sys/stat.h>
+#endif
+
#include <gdk/gdkx.h>
#include <gtk/gtkenums.h>
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-panel-macros.h>
#include <libxfce4panel/xfce-panel-convenience.h>
@@ -54,10 +71,9 @@
#define PANEL_LAUNCHER "launcher"
-static GPtrArray *config_parse_file (const char *filename);
+static GPtrArray *config_parse_file (const gchar *filename);
-static gboolean config_save_to_file (GPtrArray *panels,
- const char *filename);
+static gboolean config_save_to_file (GPtrArray *panels, const gchar *filename);
/* fallback panel */
@@ -69,7 +85,7 @@
Panel *panel;
DBG ("No suitable panel configuration was found.");
-
+
panel = panel_new ();
g_object_ref (G_OBJECT (panel));
gtk_object_sink (GTK_OBJECT (panel));
@@ -88,11 +104,11 @@
GPtrArray *
panel_config_create_panels (void)
{
- char *file = NULL;
- GPtrArray *array = NULL;
- const char *path = "xfce4" G_DIR_SEPARATOR_S
- "panel" G_DIR_SEPARATOR_S
- "panels.xml";
+ gchar *file;
+ GPtrArray *array = NULL;
+ const gchar *path = "xfce4" G_DIR_SEPARATOR_S
+ "panel" G_DIR_SEPARATOR_S
+ "panels.xml";
if (G_UNLIKELY (!xfce_allow_panel_customization ()))
{
@@ -122,12 +138,12 @@
}
}
- if (file)
+ if (G_LIKELY (file))
{
array = config_parse_file (file);
g_free (file);
}
-
+
if (!array)
array = create_fallback_panel_array ();
@@ -139,16 +155,15 @@
gboolean
panel_config_save_panels (GPtrArray * panels)
{
- gboolean failed = FALSE;
+ gchar *file;
+ gboolean failed = FALSE;
+ gint i;
+ const gchar *path = "xfce4" G_DIR_SEPARATOR_S
+ "panel" G_DIR_SEPARATOR_S
+ "panels.xml";
if (xfce_allow_panel_customization ())
{
- int i;
- char *file = NULL;
- const char *path = "xfce4" G_DIR_SEPARATOR_S
- "panel" G_DIR_SEPARATOR_S
- "panels.xml";
-
file = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, path, TRUE);
failed = !config_save_to_file (panels, file);
@@ -186,27 +201,28 @@
Panel *current_panel;
ParserState state;
- gboolean properties_set;
- gboolean monitor_set;
-
- int size;
- int monitor;
- int screen_position;
- int full_width;
- int xoffset;
- int yoffset;
- int handle_style;
- gboolean autohide;
- int transparency;
- gboolean activetrans;
+ guint properties_set : 1;
+ guint monitor_set : 1;
+
+ /* properties */
+ gint size;
+ gint monitor;
+ gint screen_position;
+ gint full_width;
+ gint xoffset;
+ gint yoffset;
+ gint handle_style;
+ guint autohide : 1;
+ gint transparency;
+ guint activetrans : 1;
};
static void
init_properties (ConfigParser *parser)
{
parser->properties_set = FALSE;
- parser->monitor_set = FALSE;
-
+ parser->monitor_set = FALSE;
+
parser->size = DEFAULT_SIZE;
parser->monitor = 0;
parser->screen_position = DEFAULT_SCREEN_POSITION;
@@ -220,69 +236,69 @@
}
static void
-config_set_property (ConfigParser *parser,
- const char *name,
- const char *value)
+config_set_property (ConfigParser *parser,
+ const gchar *name,
+ const gchar *value)
{
g_return_if_fail (name != NULL && value != NULL);
parser->properties_set = TRUE;
-
+
if (strcmp (name, "size") == 0)
{
- parser->size = (int) strtol (value, NULL, 0);
+ parser->size = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "monitor") == 0)
{
- parser->monitor = (int) strtol (value, NULL, 0);
+ parser->monitor = (gint) strtol (value, NULL, 0);
parser->monitor_set = TRUE;
}
else if (strcmp (name, "screen-position") == 0)
{
- parser->screen_position = (int) strtol (value, NULL, 0);
+ parser->screen_position = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "fullwidth") == 0)
{
- parser->full_width = ((int) strtol (value, NULL, 0));
+ parser->full_width = ((gint) strtol (value, NULL, 0));
}
else if (strcmp (name, "xoffset") == 0)
{
- parser->xoffset = (int) strtol (value, NULL, 0);
+ parser->xoffset = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "yoffset") == 0)
{
- parser->yoffset = (int) strtol (value, NULL, 0);
+ parser->yoffset = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "handlestyle") == 0)
{
- parser->handle_style = (int) strtol (value, NULL, 0);
+ parser->handle_style = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "autohide") == 0)
{
- parser->autohide = ((int) strtol (value, NULL, 0) == 1);
+ parser->autohide = ((gint) strtol (value, NULL, 0) == 1);
}
else if (strcmp (name, "transparency") == 0)
{
- parser->transparency = (int) strtol (value, NULL, 0);
+ parser->transparency = (gint) strtol (value, NULL, 0);
}
else if (strcmp (name, "activetrans") == 0)
{
- parser->activetrans = ((int) strtol (value, NULL, 0) == 1);
+ parser->activetrans = ((gint) strtol (value, NULL, 0) == 1);
}
}
static void
start_element_handler (GMarkupParseContext *context,
- const char *element_name,
- const char **attribute_names,
- const char **attribute_values,
- gpointer user_data,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
GError **error)
{
ConfigParser *parser = user_data;
- char *name = NULL;
- char *value = NULL;
- int i = 0;
+ gchar *name = NULL;
+ gchar *value = NULL;
+ gint i = 0;
switch (parser->state)
{
@@ -365,7 +381,7 @@
DBG ("Add item: name=\"%s\", id=\"%s\"", name, value);
TIMER_ELAPSED(" +++ add item: %s", name);
- panel_add_item_with_id (parser->current_panel,
+ panel_add_item_with_id (parser->current_panel,
name, value);
}
else
@@ -382,9 +398,9 @@
}
static void
-end_element_handler (GMarkupParseContext *context,
- const char *element_name,
- gpointer user_data,
+end_element_handler (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
GError **error)
{
ConfigParser *parser = user_data;
@@ -416,7 +432,7 @@
if (parser->properties_set)
{
if (parser->screen_position == XFCE_SCREEN_POSITION_NONE)
- parser->screen_position =
+ parser->screen_position =
XFCE_SCREEN_POSITION_FLOATING_H;
if (!parser->monitor_set)
@@ -424,6 +440,7 @@
parser->monitor = DefaultScreen (GDK_DISPLAY());
}
+
g_object_set (G_OBJECT (parser->current_panel),
"size", parser->size,
"monitor", parser->monitor,
@@ -464,16 +481,16 @@
};
static GPtrArray *
-config_parse_file (const char *filename)
+config_parse_file (const gchar *filename)
{
GPtrArray *array = NULL;
- char *contents;
+ gchar *contents;
GError *error;
GMarkupParseContext *context;
ConfigParser parser;
struct stat sb;
size_t bytes;
- int fd, rc;
+ gint fd, rc;
#ifdef HAVE_MMAP
void *addr;
#endif
@@ -491,11 +508,12 @@
}
contents = NULL;
-
+
#ifdef HAVE_MMAP
/* Try to mmap(2) the config file, as this save us a lot of
* kernelspace -> userspace copying
*/
+
#ifdef MAP_FILE
addr = mmap (NULL, sb.st_size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0);
#else
@@ -513,15 +531,15 @@
"Using read fallback.", filename, g_strerror (errno));
}
#endif /* HAVE_MMAP */
-
+
if (contents == NULL)
{
- contents = panel_slice_alloc ((size_t) sb.st_size);
+ contents = panel_slice_alloc ((size_t) sb.st_size);
if (contents == NULL)
{
g_critical ("Unable to allocate %lu bytes of memory to load "
- "contents of file %s: %s",
+ "contents of file %s: %s",
(gulong) sb.st_size, filename, g_strerror (errno));
goto finished;
}
@@ -552,7 +570,7 @@
/* parse the file */
error = NULL;
-
+
parser.state = START;
parser.panels = array = g_ptr_array_new ();
parser.current_panel = NULL;
@@ -573,9 +591,9 @@
#ifdef HAVE_MMAP
if (addr != NULL)
{
- if (munmap (addr, sb.st_size) < 0)
+ if (munmap (addr, sb.st_size))
{
- g_critical ("Unable to unmap file %s: %s. This should not happen!",
+ g_critical ("Unable to unmap file %s: %s. This should not happen!",
filename, g_strerror (errno));
}
@@ -602,11 +620,12 @@
}
gboolean
-config_save_to_file (GPtrArray *array, const char *filename)
+config_save_to_file (GPtrArray *array,
+ const gchar *filename)
{
- FILE *fp;
- char tmp_path[PATH_MAX];
- int i;
+ FILE *fp;
+ gchar tmp_path[PATH_MAX];
+ gint i;
g_return_val_if_fail (array != NULL, FALSE);
g_return_val_if_fail (filename != NULL || (strlen (filename) > 0), FALSE);
@@ -630,19 +649,20 @@
for (i = 0; i < array->len; ++i)
{
- GList *configlist, *l;
- Panel *panel;
- int size = 0;
- int monitor = 0;
- int screen_position = 0;
- int fullwidth = 0;
- int xoffset = 0;
- int yoffset = 0;
- int handle_style = 0;
- int transparency = 0;
- gboolean autohide = FALSE;
- gboolean activetrans = FALSE;
-
+ gint size = 0;
+ gint monitor = 0;
+ gint screen_position = 0;
+ gint fullwidth = 0;
+ gint xoffset = 0;
+ gint yoffset = 0;
+ gint handle_style = 0;
+ gint transparency = 0;
+ gboolean autohide = FALSE;
+ gboolean activetrans = FALSE;
+ Panel *panel;
+ GList *configlist, *l;
+ XfcePanelItem *item;
+
DBG ("Saving panel %d", i + 1);
panel = g_ptr_array_index (array, i);
@@ -655,46 +675,46 @@
"xoffset", &xoffset,
"yoffset", &yoffset,
"handle-style", &handle_style,
+ "autohide", &autohide,
"transparency", &transparency,
- "autohide", &autohide,
"activetrans", &activetrans,
NULL);
-
+
/* grouping */
fprintf (fp, "\t<panel>\n"
"\t\t<properties>\n");
- /* properties */
+ /* properties */
fprintf (fp, "\t\t\t<property name=\"size\" value=\"%d\"/>\n",
size);
-
+
fprintf (fp, "\t\t\t<property name=\"monitor\" value=\"%d\"/>\n",
monitor);
-
+
fprintf (fp, "\t\t\t<property name=\"screen-position\" "
"value=\"%d\"/>\n", screen_position);
-
+
fprintf (fp, "\t\t\t<property name=\"fullwidth\" value=\"%d\"/>\n",
fullwidth);
-
+
fprintf (fp, "\t\t\t<property name=\"xoffset\" value=\"%d\"/>\n",
xoffset);
-
+
fprintf (fp, "\t\t\t<property name=\"yoffset\" value=\"%d\"/>\n",
yoffset);
-
+
fprintf (fp, "\t\t\t<property name=\"handlestyle\" value=\"%d\"/>\n",
handle_style);
-
+
fprintf (fp, "\t\t\t<property name=\"autohide\" value=\"%d\"/>\n",
autohide);
-
+
fprintf (fp, "\t\t\t<property name=\"transparency\" value=\"%d\"/>\n",
transparency);
-
+
fprintf (fp, "\t\t\t<property name=\"activetrans\" value=\"%d\"/>\n",
activetrans);
-
+
/* grouping */
fprintf (fp, "\t\t</properties>\n"
"\t\t<items>\n");
@@ -704,18 +724,19 @@
for (l = configlist; l != NULL; l = l->next)
{
- XfcePanelItem *item = l->data;
+ item = l->data;
fprintf (fp, "\t\t\t<item name=\"%s\" id=\"%s\"/>\n",
- xfce_panel_item_get_name (item),
- xfce_panel_item_get_id (item));
+ xfce_panel_item_get_name (item),
+ xfce_panel_item_get_id (item));
}
-
+
g_list_free (configlist);
/* grouping */
fprintf (fp, "\t\t</items>\n"
"\t</panel>\n");
+
}
/* closing */
Modified: xfce4-panel/trunk/panel/panel-config.h
===================================================================
--- xfce4-panel/trunk/panel/panel-config.h 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-config.h 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,26 +1,24 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _PANEL_CONFIG_H
-#define _PANEL_CONFIG_H
+#ifndef __PANEL_CONFIG_H__
+#define __PANEL_CONFIG_H__
#include <glib.h>
@@ -32,4 +30,4 @@
G_END_DECLS
-#endif /* _PANEL_CONFIG_H */
+#endif /* !__PANEL_CONFIG_H__ */
Modified: xfce4-panel/trunk/panel/panel-dialogs.c
===================================================================
--- xfce4-panel/trunk/panel/panel-dialogs.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-dialogs.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,30 +1,30 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
- * Copyright © 2006 Benedikt Meurer <benny at xfce.org>
+ * Copyright (c) 2005-2007 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -51,57 +51,58 @@
GtkWidget *dlg;
GPtrArray *panels;
- Panel *panel;
- int current;
+ Panel *panel;
+ gint current;
GtkWidget *active;
-
+
GPtrArray *items;
GtkWidget *search_entry;
GtkWidget *tree;
GtkWidget *items_box;
- int panel_destroy_id;
+ gint panel_destroy_id;
};
struct _PanelManagerDialog
{
- GtkWidget *dlg;
+ GtkWidget *dlg;
- GPtrArray *panels;
- Panel *panel;
- int current;
-
+ GPtrArray *panels;
+ Panel *panel;
+ gint current;
+
GtkTooltips *tips;
- gboolean updating;
+ guint updating : 1;
/* add/remove/rename panel */
- GtkWidget *panel_selector;
- GtkWidget *add_panel;
- GtkWidget *rm_panel;
+ GtkWidget *panel_selector;
+ GtkWidget *add_panel;
+ GtkWidget *rm_panel;
/* appearance */
- GtkWidget *size;
- GtkWidget *transparency;
- GtkWidget *activetrans;
+ GtkWidget *size;
+ GtkWidget *transparency;
+ GtkWidget *activetrans;
+ GtkWidget *position;
/* monitors */
- GPtrArray *monitors;
+ GPtrArray *monitors;
/* position */
- GtkWidget *fixed;
- GtkWidget *floating;
-
- GtkWidget *fixed_box;
- GtkWidget *screen_position[12];
- GtkWidget *fullwidth;
- int n_width_items;
- GtkWidget *autohide;
+ GtkWidget *fixed;
+ GtkWidget *floating;
- GtkWidget *floating_box;
- GtkWidget *orientation;
- GtkWidget *handle_style;
+ GtkWidget *fixed_box;
+ GtkWidget *screen_position[12];
+ GtkWidget *fullwidth;
+ gint n_width_items;
+ GtkWidget *autohide;
+
+ GtkWidget *floating_box;
+ GtkWidget *orientation;
+ GtkWidget *handle_style;
};
@@ -109,17 +110,17 @@
static GtkWidget *items_dialog_widget = NULL;
-/*
- * Common Code
+/*
+ * Common Code
* ===========
*/
static void
-present_dialog (GtkWidget *dialog, GPtrArray *panels)
+present_dialog (GtkWidget *dialog,
+ GPtrArray *panels)
{
- int n = panel_app_get_current_panel ();
- GdkScreen *screen =
- gtk_widget_get_screen (g_ptr_array_index (panels, n));
+ gint n = panel_app_get_current_panel ();
+ GdkScreen *screen = gtk_widget_get_screen (g_ptr_array_index (panels, n));
if (screen != gtk_widget_get_screen (dialog))
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
@@ -127,8 +128,8 @@
gtk_window_present (GTK_WINDOW (dialog));
}
-/*
- * Add Items Dialog
+/*
+ * Add Items Dialog
* ================
*/
@@ -144,14 +145,16 @@
static gboolean
add_selected_item (PanelItemsDialog *pid)
{
- GtkTreeSelection *sel;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ GtkTreeSelection *sel;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
XfcePanelItemInfo *info;
- GtkWidget *item = NULL;
+ GtkWidget *item = NULL;
+ gint n;
+ PanelPrivate *priv;
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (pid->tree));
-
+
if (!sel)
return FALSE;
@@ -162,11 +165,10 @@
if (!xfce_panel_item_manager_is_available (info->name))
return FALSE;
-
+
if (pid->active)
{
- PanelPrivate *priv = PANEL_GET_PRIVATE (pid->panel);
- int n;
+ priv = PANEL_GET_PRIVATE (pid->panel);
n = xfce_itembar_get_item_index (XFCE_ITEMBAR (priv->itembar),
pid->active);
@@ -178,34 +180,34 @@
item = panel_add_item (pid->panel, info->name);
}
- if (item)
+ if (G_LIKELY (item))
g_idle_add ((GSourceFunc)item_configure_timeout, item);
else
xfce_err (_("Could not open \"%s\" module"), info->name);
-
+
return TRUE;
}
static gboolean
-treeview_dblclick (GtkWidget * tv, GdkEventButton * evt,
+treeview_dblclick (GtkWidget *tv,
+ GdkEventButton *evt,
PanelItemsDialog *pid)
{
if (evt->button == 1 && evt->type == GDK_2BUTTON_PRESS)
- {
- return add_selected_item (pid);
- }
+ return add_selected_item (pid);
return FALSE;
}
static void
-cursor_changed (GtkTreeView * tv, PanelItemsDialog *pid)
+cursor_changed (GtkTreeView *tv,
+ PanelItemsDialog *pid)
{
- GtkTreeSelection *sel;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ GtkTreeSelection *sel;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
XfcePanelItemInfo *info;
-
+
sel = gtk_tree_view_get_selection (tv);
gtk_tree_selection_get_selected (sel, &model, &iter);
@@ -213,7 +215,7 @@
}
static void
-treeview_destroyed (GtkWidget * tv)
+treeview_destroyed (GtkWidget *tv)
{
GtkTreeModel *store;
@@ -222,8 +224,11 @@
}
static void
-render_icon (GtkTreeViewColumn * col, GtkCellRenderer * cell,
- GtkTreeModel * model, GtkTreeIter * iter, gpointer data)
+render_icon (GtkTreeViewColumn *col,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
{
XfcePanelItemInfo *info;
@@ -231,32 +236,38 @@
if (info)
{
- g_object_set (cell, "pixbuf", info->icon, NULL);
+ g_object_set (G_OBJECT (cell),
+ "pixbuf", info->icon,
+ NULL);
}
else
{
- g_object_set (cell, "pixbuf", NULL, NULL);
+ g_object_set (G_OBJECT (cell),
+ "pixbuf", NULL,
+ NULL);
}
}
static void
-render_text (GtkTreeViewColumn * col, GtkCellRenderer * cell,
- GtkTreeModel * model, GtkTreeIter * iter, GtkWidget * treeview)
+render_text (GtkTreeViewColumn *col,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GtkWidget *treeview)
{
XfcePanelItemInfo *info;
+ gboolean insensitive;
+ gchar text[512];
gtk_tree_model_get (model, iter, 0, &info, -1);
if (info)
{
- gboolean insensitive;
- char text[512];
+ insensitive = !xfce_panel_item_manager_is_available (info->name);
- insensitive = !xfce_panel_item_manager_is_available (info->name);
-
if (info->comment)
{
- g_snprintf (text, 512, "<b>%s</b>\n%s", info->display_name,
+ g_snprintf (text, 512, "<b>%s</b>\n%s", info->display_name,
info->comment);
}
else
@@ -264,33 +275,47 @@
g_snprintf (text, 512, "<b>%s</b>", info->display_name);
}
- g_object_set (cell, "markup", text,
- "foreground-set", insensitive, NULL);
+ g_object_set (G_OBJECT (cell),
+ "markup", text,
+ "foreground-set", insensitive,
+ NULL);
}
else
{
- g_object_set (cell, "markup", "", "foreground-set", TRUE, NULL);
+ g_object_set (G_OBJECT (cell),
+ "markup", "",
+ "foreground-set", TRUE,
+ NULL);
}
}
static void
-treeview_data_received (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, GtkSelectionData *data,
- guint info, guint time, gpointer user_data)
+treeview_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ gpointer user_data)
{
gboolean handled = FALSE;
DBG (" + drag data received: %d", info);
-
+
if (data->length && info == TARGET_PLUGIN_WIDGET)
handled = TRUE;
-
+
gtk_drag_finish (context, handled, handled, time);
}
static gboolean
-treeview_drag_drop (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time, gpointer user_data)
+treeview_drag_drop (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time,
+ gpointer user_data)
{
GdkAtom atom = gtk_drag_dest_find_target (widget, context, NULL);
@@ -304,37 +329,42 @@
}
static void
-treeview_data_get (GtkWidget *widget, GdkDragContext *drag_context,
- GtkSelectionData *data, guint info,
- guint time, gpointer user_data)
+treeview_data_get (GtkWidget *widget,
+ GdkDragContext *drag_context,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ gpointer user_data)
{
+ GtkTreeSelection *sel;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ XfcePanelItemInfo *item_info;
+
DBG (" + drag data get: %d", info);
-
+
if (info == TARGET_PLUGIN_NAME)
{
- GtkTreeSelection *sel;
- GtkTreeModel *model;
- GtkTreeIter iter;
- XfcePanelItemInfo *info;
-
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
- if (!sel)
+ if (G_UNLIKELY (!sel))
{
DBG ("No selection!");
return;
}
-
+
gtk_tree_selection_get_selected (sel, &model, &iter);
- gtk_tree_model_get (model, &iter, 0, &info, -1);
+ gtk_tree_model_get (model, &iter, 0, &item_info, -1);
- if (!xfce_panel_item_manager_is_available (info->name))
+ if (G_UNLIKELY (!xfce_panel_item_manager_is_available (item_info->name)))
return;
-
- DBG (" + set data: %s", info->name);
- gtk_selection_data_set (data, data->target, 8,
- (guchar *)info->name, strlen (info->name));
+
+ DBG (" + set data: %s", item_info->name);
+
+ gtk_selection_data_set (data, data->target, 8,
+ (guchar *)item_info->name,
+ strlen (item_info->name));
}
}
@@ -390,32 +420,35 @@
static void
add_item_treeview (PanelItemsDialog *pid)
{
- GtkWidget *tv, *scroll;
- GtkCellRenderer *cell;
+ GtkWidget *tv, *scroll;
+ GtkCellRenderer *cell;
GtkTreeViewColumn *col;
- GtkListStore *store;
- GtkTreeModel *filter;
- GtkTreeModel *model;
- GtkTreePath *path;
- GtkTreeIter iter;
- int i;
- GdkColor *color;
+ GtkListStore *store;
+ GtkTreeModel *filter;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gint i;
+ GdkColor *color;
+ GtkRequisition req;
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scroll);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER,
+ GTK_POLICY_NEVER,
GTK_POLICY_NEVER);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
+ GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (pid->items_box), scroll, TRUE, TRUE, 0);
-
+
store = gtk_list_store_new (1, G_TYPE_POINTER);
model = GTK_TREE_MODEL (store);
filter = gtk_tree_model_filter_new (model, NULL);
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), item_visible_func, pid->search_entry, NULL);
- g_signal_connect_swapped (G_OBJECT (pid->search_entry), "changed", G_CALLBACK (gtk_tree_model_filter_refilter), filter);
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
+ item_visible_func, pid->search_entry, NULL);
+ g_signal_connect_swapped (G_OBJECT (pid->search_entry), "changed",
+ G_CALLBACK (gtk_tree_model_filter_refilter), filter);
pid->tree = tv = gtk_tree_view_new_with_model (filter);
gtk_widget_show (tv);
@@ -423,7 +456,8 @@
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tv), FALSE);
gtk_container_add (GTK_CONTAINER (scroll), tv);
- g_signal_connect (tv, "destroy", G_CALLBACK (treeview_destroyed), NULL);
+ g_signal_connect (G_OBJECT (tv), "destroy",
+ G_CALLBACK (treeview_destroyed), NULL);
g_object_unref (G_OBJECT (filter));
g_object_unref (G_OBJECT (store));
@@ -433,15 +467,15 @@
panel_dnd_set_widget_delete_dest (tv);
- g_signal_connect (tv, "drag-data-get", G_CALLBACK (treeview_data_get),
- pid);
+ g_signal_connect (G_OBJECT (tv), "drag-data-get",
+ G_CALLBACK (treeview_data_get), pid);
- g_signal_connect (tv, "drag-data-received",
+ g_signal_connect (G_OBJECT (tv), "drag-data-received",
G_CALLBACK (treeview_data_received), pid);
-
- g_signal_connect (tv, "drag-drop",
+
+ g_signal_connect (G_OBJECT (tv), "drag-drop",
G_CALLBACK (treeview_drag_drop), pid);
-
+
/* create the view */
col = gtk_tree_view_column_new ();
gtk_tree_view_column_set_spacing (col, BORDER);
@@ -450,43 +484,41 @@
cell = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_cell_data_func (col, cell,
- (GtkTreeCellDataFunc)
- render_icon, NULL, NULL);
+ (GtkTreeCellDataFunc) render_icon,
+ NULL, NULL);
cell = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (col, cell, TRUE);
gtk_tree_view_column_set_cell_data_func (col, cell,
- (GtkTreeCellDataFunc)
- render_text, tv, NULL);
+ (GtkTreeCellDataFunc) render_text,
+ tv, NULL);
color = &(tv->style->fg[GTK_STATE_INSENSITIVE]);
- g_object_set (cell, "foreground-gdk", color, NULL);
-
+ g_object_set (G_OBJECT (cell), "foreground-gdk", color, NULL);
+
/* fill model */
for (i = 0; i < pid->items->len; ++i)
{
if (i == 5)
{
- GtkRequisition req;
-
gtk_widget_size_request (tv, &req);
gtk_widget_set_size_request (tv, -1, req.height);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER,
+ GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS);
- }
+ }
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0,
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0,
g_ptr_array_index (pid->items, i), -1);
}
- g_signal_connect (tv, "cursor_changed", G_CALLBACK (cursor_changed),
- pid);
+ g_signal_connect (G_OBJECT (tv), "cursor_changed",
+ G_CALLBACK (cursor_changed), pid);
- g_signal_connect (tv, "button-press-event",
- G_CALLBACK (treeview_dblclick), pid);
+ g_signal_connect (G_OBJECT (tv), "button-press-event",
+ G_CALLBACK (treeview_dblclick), pid);
path = gtk_tree_path_new_from_string ("0");
gtk_tree_view_set_cursor (GTK_TREE_VIEW (tv), path, NULL, FALSE);
@@ -497,11 +529,11 @@
item_dialog_opened (Panel *panel)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
-
+
panel_block_autohide (panel);
xfce_itembar_raise_event_window (XFCE_ITEMBAR (priv->itembar));
-
+
panel_dnd_set_dest (priv->itembar);
panel_dnd_set_widget_source (priv->itembar);
@@ -514,13 +546,13 @@
item_dialog_closed (Panel *panel)
{
PanelPrivate *priv = PANEL_GET_PRIVATE (panel);
-
+
panel_unblock_autohide (panel);
-
+
xfce_itembar_lower_event_window (XFCE_ITEMBAR (priv->itembar));
panel_set_items_sensitive (panel, TRUE);
-
+
panel_dnd_unset_dest (priv->itembar);
panel_dnd_unset_source (priv->itembar);
@@ -528,7 +560,9 @@
}
static void
-item_dialog_response (GtkWidget *dlg, int response, PanelItemsDialog *pid)
+item_dialog_response (GtkWidget *dlg,
+ gint response,
+ PanelItemsDialog *pid)
{
if (response != GTK_RESPONSE_HELP)
{
@@ -543,7 +577,7 @@
xfce_panel_item_manager_free_item_info_list (pid->items);
gtk_widget_destroy (dlg);
-
+
g_signal_handler_disconnect (pid->panel, pid->panel_destroy_id);
panel_slice_free (PanelItemsDialog, pid);
@@ -551,7 +585,7 @@
}
else
{
- xfce_exec_on_screen (gtk_widget_get_screen (dlg),
+ xfce_exec_on_screen (gtk_widget_get_screen (dlg),
"xfhelp4 panel.html", FALSE, FALSE, NULL);
}
}
@@ -563,33 +597,33 @@
}
void
-add_items_dialog (GPtrArray *panels, GtkWidget *active_item)
+add_items_dialog (GPtrArray *panels,
+ GtkWidget *active_item)
{
PanelItemsDialog *pid;
- Panel *panel;
- GtkWidget *dlg, *vbox, *img, *hbox, *label;
- char *markup;
-
+ Panel *panel;
+ GtkWidget *dlg, *vbox, *img, *hbox, *label;
+ gchar *markup;
+
if (items_dialog_widget)
{
present_dialog (items_dialog_widget, panels);
return;
}
-
+
pid = panel_slice_new0 (PanelItemsDialog);
/* panels */
pid->panels = panels;
pid->current = panel_app_get_current_panel();
- panel = pid->panel =
- g_ptr_array_index (panels, pid->current);
+ panel = pid->panel = g_ptr_array_index (panels, pid->current);
pid->active = active_item;
-
+
/* available items */
pid->items = xfce_panel_item_manager_get_item_info_list ();
-
+
/* main dialog widget */
- items_dialog_widget = pid->dlg = dlg =
+ items_dialog_widget = pid->dlg = dlg =
xfce_titled_dialog_new_with_buttons (_("Add Items to the Panel"), NULL,
GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
@@ -597,13 +631,14 @@
GTK_STOCK_ADD, GTK_RESPONSE_OK,
NULL);
gtk_window_set_icon_name (GTK_WINDOW (dlg), "xfce4-panel");
-
- g_signal_connect (dlg, "response", G_CALLBACK (item_dialog_response), pid);
- pid->panel_destroy_id =
- g_signal_connect_swapped (panel, "destroy",
- G_CALLBACK (items_dialog_panel_destroyed),
- pid);
+ g_signal_connect (G_OBJECT (dlg), "response",
+ G_CALLBACK (item_dialog_response), pid);
+
+ pid->panel_destroy_id =
+ g_signal_connect_swapped (G_OBJECT (panel), "destroy",
+ G_CALLBACK (items_dialog_panel_destroyed), pid);
+
pid->items_box = vbox = gtk_vbox_new (FALSE, BORDER);
gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2);
gtk_widget_show (vbox);
@@ -614,7 +649,7 @@
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
- img = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO,
+ img = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO,
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_misc_set_alignment (GTK_MISC (img), 0.0f, 0.5f);
gtk_widget_show (img);
@@ -646,18 +681,15 @@
frap_icon_entry_set_stock_id (FRAP_ICON_ENTRY (pid->search_entry), GTK_STOCK_FIND);
gtk_widget_show (pid->search_entry);
gtk_box_pack_end (GTK_BOX (hbox), pid->search_entry, FALSE, FALSE, 0);
-
+
add_item_treeview (pid);
/* make panels insensitive and set up dnd */
g_ptr_array_foreach (panels, (GFunc)item_dialog_opened, NULL);
gtk_window_stick(GTK_WINDOW (dlg));
+ xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (dlg));
- gtk_widget_realize (dlg);
- gdk_x11_window_set_user_time (GTK_WIDGET (dlg)->window,
- gdk_x11_get_server_time (GTK_WIDGET (dlg)->window));
- xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (dlg));
gtk_widget_show (dlg);
panel_app_register_dialog (dlg);
@@ -665,17 +697,17 @@
gtk_window_present (GTK_WINDOW (dlg));
}
-/*
- * Manage Panels Dialog
+/*
+ * Manage Panels Dialog
* ====================
*/
static gboolean
can_span_monitors (Panel *panel)
{
- return ( (panel_app_monitors_equal_height () &&
+ return ( (panel_app_monitors_equal_height () &&
panel_is_horizontal (panel))
- || (panel_app_monitors_equal_width () &&
+ || (panel_app_monitors_equal_width () &&
!panel_is_horizontal (panel)) );
}
@@ -684,30 +716,32 @@
static void
update_widgets (PanelManagerDialog *pmd)
{
- PanelPrivate *priv = PANEL_GET_PRIVATE (pmd->panel);
- int i;
+ PanelPrivate *priv = PANEL_GET_PRIVATE (pmd->panel);
+ gint i;
+ GtkToggleButton *tb;
+ XfceHandleStyle style;
pmd->updating = TRUE;
-
+
/* monitor */
if (pmd->monitors)
{
for (i = 0; i < pmd->monitors->len; ++i)
{
- GtkToggleButton *tb = g_ptr_array_index (pmd->monitors, i);
-
+ tb = g_ptr_array_index (pmd->monitors, i);
+
gtk_toggle_button_set_active (tb, i == priv->monitor);
}
}
-
+
/* appearance */
gtk_range_set_value (GTK_RANGE (pmd->size), priv->size);
if (pmd->transparency)
{
- gtk_range_set_value (GTK_RANGE (pmd->transparency),
+ gtk_range_set_value (GTK_RANGE (pmd->transparency),
priv->transparency);
-
+
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->activetrans),
!priv->activetrans);
}
@@ -715,43 +749,41 @@
/* behavior */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->autohide),
priv->autohide);
-
+
/* position */
if (!xfce_screen_position_is_floating (priv->screen_position))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->fixed), TRUE);
-
+
gtk_widget_hide (pmd->floating_box);
gtk_widget_show (pmd->fixed_box);
-
+
for (i = 0; i < 12; ++i)
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (pmd->screen_position[i]),
- (int)priv->screen_position == i+1);
+ (gint) priv->screen_position == i+1);
}
- gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->fullwidth),
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->fullwidth),
priv->full_width);
}
else
{
- XfceHandleStyle style;
-
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pmd->floating), TRUE);
-
+
gtk_widget_hide (pmd->fixed_box);
gtk_widget_show (pmd->floating_box);
- gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->orientation),
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->orientation),
panel_is_horizontal (pmd->panel) ? 0 : 1);
style = xfce_panel_window_get_handle_style (
XFCE_PANEL_WINDOW (pmd->panel));
if (style == XFCE_HANDLE_STYLE_NONE)
style = XFCE_HANDLE_STYLE_BOTH;
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->handle_style),
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->handle_style),
style - 1);
}
@@ -761,23 +793,24 @@
/* position */
static void
-type_changed (GtkToggleButton *tb, PanelManagerDialog *pmd)
+type_changed (GtkToggleButton *tb,
+ PanelManagerDialog *pmd)
{
PanelPrivate *priv;
- int active;
-
+ gint active;
+
if (pmd->updating)
return;
if (!gtk_toggle_button_get_active (tb))
return;
-
+
priv = PANEL_GET_PRIVATE (pmd->panel);
/* 0 for fixed, 1 for floating */
active = GTK_WIDGET (tb) == pmd->fixed ? 0 : 1;
-
- if ((active == 0) ==
+
+ if ((active == 0) ==
(priv->screen_position > XFCE_SCREEN_POSITION_NONE &&
priv->screen_position < XFCE_SCREEN_POSITION_FLOATING_H))
{
@@ -793,7 +826,7 @@
}
else
{
- panel_set_screen_position (pmd->panel,
+ panel_set_screen_position (pmd->panel,
XFCE_SCREEN_POSITION_FLOATING_V);
}
@@ -809,7 +842,7 @@
}
else
{
- panel_set_screen_position (pmd->panel,
+ panel_set_screen_position (pmd->panel,
XFCE_SCREEN_POSITION_E);
}
@@ -823,54 +856,55 @@
}
static gboolean
-screen_position_pressed (GtkToggleButton *tb, GdkEvent *ev,
+screen_position_pressed (GtkToggleButton *tb,
+ GdkEvent *ev,
PanelManagerDialog *pmd)
{
- if (ev->type == GDK_KEY_PRESS &&
+ GtkToggleButton *button;
+ gint i, full_width;
+
+ if (ev->type == GDK_KEY_PRESS &&
((GdkEventKey *)ev)->keyval == GDK_Tab)
{
return FALSE;
}
-
+
if (!gtk_toggle_button_get_active (tb))
{
if (ev->type == GDK_BUTTON_PRESS ||
- (ev->type == GDK_KEY_PRESS &&
+ (ev->type == GDK_KEY_PRESS &&
(((GdkEventKey *)ev)->keyval == GDK_space ||
((GdkEventKey *)ev)->keyval == GDK_Return)))
{
- int i, full_width;
-
for (i = 0; i < 12; ++i)
{
- GtkToggleButton *button =
- GTK_TOGGLE_BUTTON (pmd->screen_position[i]);
+ button = GTK_TOGGLE_BUTTON (pmd->screen_position[i]);
if (button == tb)
{
gtk_toggle_button_set_active (button, TRUE);
panel_set_screen_position (pmd->panel, i + 1);
-
+
/* fix up full width setting */
full_width = gtk_combo_box_get_active (
GTK_COMBO_BOX (pmd->fullwidth));
-
+
for ( ; pmd->n_width_items > 0; pmd->n_width_items--)
{
gtk_combo_box_remove_text (
- GTK_COMBO_BOX (pmd->fullwidth),
+ GTK_COMBO_BOX (pmd->fullwidth),
pmd->n_width_items - 1);
}
-
+
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
_("Normal Width"));
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
- _("Full Width"));
+ _("Full Width"));
pmd->n_width_items = 2;
if (can_span_monitors(pmd->panel))
{
gtk_combo_box_append_text (
- GTK_COMBO_BOX (pmd->fullwidth),
+ GTK_COMBO_BOX (pmd->fullwidth),
_("Span Monitors"));
pmd->n_width_items = 3;
}
@@ -879,7 +913,7 @@
panel_set_full_width (pmd->panel, full_width);
gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->fullwidth),
full_width);
- }
+ }
else
{
gtk_toggle_button_set_active (button, FALSE);
@@ -892,7 +926,8 @@
}
static void
-fullwidth_changed (GtkComboBox *box, PanelManagerDialog *pmd)
+fullwidth_changed (GtkComboBox *box,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
@@ -901,7 +936,8 @@
}
static void
-autohide_changed (GtkToggleButton *tb, PanelManagerDialog *pmd)
+autohide_changed (GtkToggleButton *tb,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
@@ -910,18 +946,19 @@
}
static void
-orientation_changed (GtkComboBox *box, PanelManagerDialog *pmd)
+orientation_changed (GtkComboBox *box,
+ PanelManagerDialog *pmd)
{
XfceScreenPosition position;
- int n;
- gboolean tmp_updating;
-
- position = gtk_combo_box_get_active (box) == 0 ?
+ gint n;
+ gboolean tmp_updating;
+
+ position = gtk_combo_box_get_active (box) == 0 ?
XFCE_SCREEN_POSITION_FLOATING_H :
XFCE_SCREEN_POSITION_FLOATING_V;
-
+
tmp_updating = pmd->updating;
-
+
pmd->updating = TRUE;
n = gtk_combo_box_get_active (GTK_COMBO_BOX (pmd->handle_style));
@@ -930,16 +967,16 @@
if (position == XFCE_SCREEN_POSITION_FLOATING_H)
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Left"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Right"));
}
else
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Top"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Bottom"));
}
@@ -951,7 +988,8 @@
}
static void
-handle_style_changed (GtkComboBox *box, PanelManagerDialog *pmd)
+handle_style_changed (GtkComboBox *box,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
@@ -961,17 +999,18 @@
}
static void
-add_position_options (GtkBox *box, PanelManagerDialog *pmd)
+add_position_options (GtkBox *box,
+ PanelManagerDialog *pmd)
{
- GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label, *sep;
+ GtkWidget *frame, *vbox, *vbox2, *hbox, *table, *align, *label, *sep;
GtkSizeGroup *sg;
- int i;
-
+ gint i;
+
/* position */
frame = xfce_create_framebox (_("Position"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
-
+
vbox2 = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (align), vbox2);
@@ -981,27 +1020,27 @@
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, TRUE, TRUE, 0);
- pmd->fixed =
+ pmd->fixed =
gtk_radio_button_new_with_label (NULL, _("Fixed Position"));
gtk_widget_show (pmd->fixed);
gtk_box_pack_start (GTK_BOX (hbox), pmd->fixed, FALSE, FALSE, 0);
-
- pmd->floating =
+
+ pmd->floating =
gtk_radio_button_new_with_label_from_widget (
GTK_RADIO_BUTTON (pmd->fixed), _("Freely Moveable"));
gtk_widget_show (pmd->floating);
gtk_box_pack_start (GTK_BOX (hbox), pmd->floating, FALSE, FALSE, 0);
- g_signal_connect (pmd->fixed, "toggled", G_CALLBACK (type_changed),
- pmd);
-
- g_signal_connect (pmd->floating, "toggled", G_CALLBACK (type_changed),
- pmd);
-
+ g_signal_connect (G_OBJECT (pmd->fixed), "toggled",
+ G_CALLBACK (type_changed), pmd);
+
+ g_signal_connect (G_OBJECT (pmd->floating), "toggled",
+ G_CALLBACK (type_changed), pmd);
+
sep = gtk_hseparator_new ();
gtk_widget_show (sep);
gtk_box_pack_start (GTK_BOX (vbox2), sep, FALSE, FALSE, 0);
-
+
/* fixed */
pmd->fixed_box = hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
@@ -1019,7 +1058,7 @@
align = gtk_alignment_new (0, 0, 0, 0);
gtk_widget_show (align);
gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
-
+
for (i = 0; i < 12; ++i)
{
pmd->screen_position[i] = gtk_toggle_button_new ();
@@ -1030,53 +1069,53 @@
else
gtk_widget_set_size_request (pmd->screen_position[i], 15, 25);
- g_signal_connect (pmd->screen_position[i], "button-press-event",
+ g_signal_connect (G_OBJECT (pmd->screen_position[i]), "button-press-event",
G_CALLBACK (screen_position_pressed), pmd);
-
- g_signal_connect (pmd->screen_position[i], "key-press-event",
+
+ g_signal_connect (G_OBJECT (pmd->screen_position[i]), "key-press-event",
G_CALLBACK (screen_position_pressed), pmd);
}
/* fixed:postion:top */
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[0],
1, 2, 0, 1);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[1],
2, 3, 0, 1);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[2],
3, 4, 0, 1);
-
+
/* fixed:postion:left */
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[3],
0, 1, 1, 2);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[4],
0, 1, 2, 3);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[5],
0, 1, 3, 4);
-
+
/* fixed:postion:right */
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[6],
4, 5, 1, 2);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[7],
4, 5, 2, 3);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[8],
4, 5, 3, 4);
-
+
/* fixed:postion:bottom */
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[9],
1, 2, 4, 5);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[10],
2, 3, 4, 5);
-
+
gtk_table_attach_defaults (GTK_TABLE (table), pmd->screen_position[11],
3, 4, 4, 5);
-
+
/* fixed:full width */
vbox = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (vbox);
@@ -1089,34 +1128,34 @@
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
_("Normal Width"));
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
- _("Full Width"));
+ _("Full Width"));
pmd->n_width_items = 2;
if (can_span_monitors (pmd->panel))
{
pmd->n_width_items = 3;
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->fullwidth),
_("Span Monitors"));
}
- g_signal_connect (pmd->fullwidth, "changed",
+ g_signal_connect (G_OBJECT (pmd->fullwidth), "changed",
G_CALLBACK (fullwidth_changed), pmd);
-
+
/* fixed:autohide */
- pmd->autohide =
+ pmd->autohide =
gtk_check_button_new_with_mnemonic (_("Auto_hide"));
gtk_widget_show (pmd->autohide);
gtk_box_pack_start (GTK_BOX (vbox), pmd->autohide, FALSE, FALSE, 0);
-
- g_signal_connect (pmd->autohide, "toggled",
+
+ g_signal_connect (G_OBJECT (pmd->autohide), "toggled",
G_CALLBACK (autohide_changed), pmd);
-
+
/* floating */
pmd->floating_box = vbox = gtk_vbox_new (FALSE, BORDER);
/* don't show by default */
gtk_box_pack_start (GTK_BOX (vbox2), vbox, TRUE, TRUE, 0);
- sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
+ sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -1127,19 +1166,19 @@
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (sg, label);
-
+
pmd->orientation = gtk_combo_box_new_text ();
gtk_widget_show (pmd->orientation);
gtk_box_pack_start (GTK_BOX (hbox), pmd->orientation, TRUE, TRUE, 0);
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
_("Horizontal"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->orientation),
_("Vertical"));
-
- g_signal_connect (pmd->orientation, "changed",
+
+ g_signal_connect (G_OBJECT (pmd->orientation), "changed",
G_CALLBACK (orientation_changed), pmd);
-
+
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -1150,56 +1189,59 @@
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (sg, label);
-
+
pmd->handle_style = gtk_combo_box_new_text ();
gtk_widget_show (pmd->handle_style);
gtk_box_pack_start (GTK_BOX (hbox), pmd->handle_style, TRUE, TRUE, 0);
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("At both sides"));
if (panel_is_horizontal (pmd->panel))
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Left"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Right"));
}
else
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Top"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->handle_style),
_("Bottom"));
}
- g_signal_connect (pmd->handle_style, "changed",
+ g_signal_connect (G_OBJECT (pmd->handle_style), "changed",
G_CALLBACK (handle_style_changed), pmd);
-
+
g_object_unref (G_OBJECT (sg));
}
/* monitors */
static gboolean
-monitor_pressed (GtkToggleButton *tb, GdkEvent *ev, PanelManagerDialog *pmd)
+monitor_pressed (GtkToggleButton *tb,
+ GdkEvent *ev,
+ PanelManagerDialog *pmd)
{
- if (ev->type == GDK_KEY_PRESS &&
+ gint i;
+ GtkToggleButton *mon;
+
+ if (ev->type == GDK_KEY_PRESS &&
((GdkEventKey *)ev)->keyval == GDK_Tab)
{
return FALSE;
}
-
+
if (!gtk_toggle_button_get_active (tb))
{
if (ev->type == GDK_BUTTON_PRESS ||
- (ev->type == GDK_KEY_PRESS &&
+ (ev->type == GDK_KEY_PRESS &&
(((GdkEventKey *)ev)->keyval == GDK_space ||
((GdkEventKey *)ev)->keyval == GDK_Return)))
{
- int i;
-
for (i = 0; i < pmd->monitors->len; ++i)
{
- GtkToggleButton *mon = g_ptr_array_index (pmd->monitors, i);
+ mon = g_ptr_array_index (pmd->monitors, i);
if (mon == tb)
{
@@ -1218,17 +1260,21 @@
}
static void
-add_monitor_selector (GtkBox *box, PanelManagerDialog *pmd)
+add_monitor_selector (GtkBox *box,
+ PanelManagerDialog *pmd)
{
- int n_monitors, i;
+ gint n_monitors, i;
+ GtkWidget *frame, *align, *hbox;
+ GtkWidget *scroll = NULL;
+ GtkWidget *ebox, *ebox2, *b, *label;
+ GtkStyle *style;
+ gchar markup[10];
+ GtkRequisition req;
n_monitors = panel_app_get_n_monitors ();
-
+
if (n_monitors > 1)
{
- GtkWidget *frame, *align, *hbox;
- GtkWidget *scroll = NULL;
-
frame = xfce_create_framebox (_("Select Monitor"), &align);
gtk_widget_show (frame);
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
@@ -1241,51 +1287,45 @@
for (i = 0; i < n_monitors; ++i)
{
- GtkWidget *ebox, *ebox2, *b, *label;
- GtkStyle *style;
- char markup[10];
-
/* use a scroll window if more than 4 monitors */
if (i == 5)
{
- GtkRequisition req;
-
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scroll);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER,
+ GTK_POLICY_NEVER,
GTK_POLICY_NEVER);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
-
+
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
gtk_scrolled_window_add_with_viewport (
GTK_SCROLLED_WINDOW (scroll), hbox);
-
+
gtk_widget_size_request (scroll, &req);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_ALWAYS,
+ GTK_POLICY_ALWAYS,
GTK_POLICY_NEVER);
gtk_widget_set_size_request (scroll, req.width, -1);
}
g_snprintf (markup, 10, "<b>%d</b>", i + 1);
-
+
ebox = gtk_event_box_new ();
style = gtk_widget_get_style (ebox);
gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL,
&(style->bg[GTK_STATE_SELECTED]));
gtk_widget_show (ebox);
gtk_box_pack_start (GTK_BOX (hbox), ebox, FALSE, FALSE, 0);
-
+
ebox2 = gtk_event_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (ebox2), 3);
gtk_widget_show (ebox2);
gtk_container_add (GTK_CONTAINER (ebox), ebox2);
-
+
b = gtk_toggle_button_new();
gtk_button_set_relief (GTK_BUTTON (b), GTK_RELIEF_NONE);
gtk_widget_set_size_request (b, 40, 30);
@@ -1297,12 +1337,12 @@
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (b), label);
- g_signal_connect (b, "button-press-event",
+ g_signal_connect (G_OBJECT (b), "button-press-event",
G_CALLBACK (monitor_pressed), pmd);
-
- g_signal_connect (b, "key-press-event",
+
+ g_signal_connect (G_OBJECT (b), "key-press-event",
G_CALLBACK (monitor_pressed), pmd);
-
+
g_ptr_array_add (pmd->monitors, b);
}
@@ -1315,25 +1355,28 @@
/* appearance */
static void
-size_changed (GtkRange *range, PanelManagerDialog *pmd)
+size_changed (GtkRange *range,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
- panel_set_size (pmd->panel, (int) gtk_range_get_value (range));
+ panel_set_size (pmd->panel, (gint) gtk_range_get_value (range));
}
static void
-transparency_changed (GtkRange *range, PanelManagerDialog *pmd)
+transparency_changed (GtkRange *range,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
- panel_set_transparency (pmd->panel, (int) gtk_range_get_value (range));
+ panel_set_transparency (pmd->panel, (gint) gtk_range_get_value (range));
}
static void
-activetrans_toggled (GtkToggleButton *tb, PanelManagerDialog *pmd)
+activetrans_toggled (GtkToggleButton *tb,
+ PanelManagerDialog *pmd)
{
if (pmd->updating)
return;
@@ -1342,88 +1385,134 @@
}
static void
-add_appearance_options (GtkBox *box, PanelManagerDialog *pmd)
+popup_position_changed (GtkComboBox *box,
+ PanelManagerDialog *pmd)
{
- static Atom composite_atom = 0;
- GtkWidget *frame, *table, *label, *align;
+ if (pmd->updating)
+ return;
+}
+static void
+add_appearance_options (GtkBox *box,
+ PanelManagerDialog *pmd)
+{
+ static Atom composite_atom = 0;
+ GtkWidget *frame, *table, *hbox, *label, *align;
+ gchar text[16];
+ GtkSizeGroup *size_group;
+
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
frame = xfce_create_framebox (_("Appearance"), &align);
gtk_widget_show (frame);
- gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
+ gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
- table = gtk_table_new (3, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), BORDER);
- gtk_table_set_col_spacings (GTK_TABLE (table), BORDER);
+ table = gtk_vbox_new (FALSE, BORDER);
gtk_widget_show (table);
gtk_container_add (GTK_CONTAINER (align), table);
-
+
/* size */
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
+
label = gtk_label_new (_("Size (pixels):"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
-
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_size_group_add_widget (size_group, label);
+
pmd->size = gtk_hscale_new_with_range (MIN_SIZE, MAX_SIZE, 2);
gtk_scale_set_value_pos (GTK_SCALE (pmd->size), GTK_POS_LEFT);
gtk_range_set_update_policy (GTK_RANGE (pmd->size), GTK_UPDATE_DELAYED);
gtk_widget_show (pmd->size);
- gtk_table_attach (GTK_TABLE (table), pmd->size, 1, 2, 0, 1,
- GTK_FILL|GTK_EXPAND, 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->size, TRUE, TRUE, 0);
- g_signal_connect (pmd->size, "value-changed",
+ g_signal_connect (G_OBJECT (pmd->size), "value-changed",
G_CALLBACK (size_changed), pmd);
/* transparency */
if (G_UNLIKELY (!composite_atom))
{
- char text[16];
- g_snprintf (text, 16, "_NET_WM_CM_S%d",
+ g_snprintf (text, 16, "_NET_WM_CM_S%d",
GDK_SCREEN_XNUMBER(gdk_screen_get_default()));
- composite_atom =
+ composite_atom =
XInternAtom (GDK_DISPLAY (), text, False);
}
if (XGetSelectionOwner (GDK_DISPLAY (), composite_atom))
{
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
+
label = gtk_label_new (_("Transparency (%):"));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
- GTK_FILL, 0, 0, 0);
-
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_size_group_add_widget (size_group, label);
+
pmd->transparency = gtk_hscale_new_with_range (0, 100, 5);
gtk_scale_set_value_pos (GTK_SCALE (pmd->transparency), GTK_POS_LEFT);
gtk_range_set_update_policy (GTK_RANGE (pmd->transparency),
GTK_UPDATE_DELAYED);
gtk_widget_show (pmd->transparency);
- gtk_table_attach (GTK_TABLE (table), pmd->transparency, 1, 2, 1, 2,
- GTK_FILL|GTK_EXPAND, 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->transparency, TRUE, TRUE, 0);
- g_signal_connect (pmd->transparency, "value-changed",
+ g_signal_connect (G_OBJECT (pmd->transparency), "value-changed",
G_CALLBACK (transparency_changed), pmd);
- align = gtk_alignment_new (0, 0, 0, 0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0);
- gtk_widget_show (align);
- gtk_table_attach (GTK_TABLE (table), align, 0, 3, 2, 3,
- GTK_FILL|GTK_EXPAND, 0, 0, 0);
-
- pmd->activetrans =
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new ("");
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_size_group_add_widget (size_group, label);
+
+ pmd->activetrans =
gtk_check_button_new_with_label (_("Make active panel opaque"));
gtk_widget_show (pmd->activetrans);
- gtk_container_add (GTK_CONTAINER (align), pmd->activetrans);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->activetrans, TRUE, TRUE, 0);
- g_signal_connect (pmd->activetrans, "toggled",
+ g_signal_connect (G_OBJECT (pmd->activetrans), "toggled",
G_CALLBACK (activetrans_toggled), pmd);
}
+
+ /* popup position */
+ hbox = gtk_hbox_new (FALSE, BORDER);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (table), hbox, FALSE, FALSE, 0);
+
+ label = gtk_label_new (_("Popup position:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_size_group_add_widget (size_group, label);
+
+ pmd->position = gtk_combo_box_new_text ();
+ gtk_widget_show (pmd->position);
+ gtk_box_pack_start (GTK_BOX (hbox), pmd->position, TRUE, TRUE, 0);
+
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->position), _("Automatic"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->position), _("Left"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->position), _("Right"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->position), _("Top"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->position), _("Bottom"));
+
+ g_signal_connect (G_OBJECT (pmd->position), "value-changed",
+ G_CALLBACK (popup_position_changed), pmd);
+
+ g_object_unref (G_OBJECT (size_group));
}
/* panel selector: add/remove/rename panel */
static void
-panel_selected (GtkComboBox * combo, PanelManagerDialog * pmd)
+panel_selected (GtkComboBox *combo,
+ PanelManagerDialog *pmd)
{
- int n = gtk_combo_box_get_active (combo);
+ gint n = gtk_combo_box_get_active (combo);
if (n == pmd->current)
return;
@@ -1435,10 +1524,11 @@
}
static void
-add_panel (GtkWidget * w, PanelManagerDialog * pmd)
+add_panel (GtkWidget *w,
+ PanelManagerDialog *pmd)
{
- char name[20];
- int n, x, y;
+ gchar name[20];
+ gint n, x, y;
n = pmd->panels->len;
@@ -1457,7 +1547,7 @@
gtk_window_get_position (GTK_WINDOW (pmd->dlg), &x, &y);
- x += (pmd->dlg->allocation.width -
+ x += (pmd->dlg->allocation.width -
GTK_WIDGET (pmd->panel)->allocation.width) / 2;
y += pmd->dlg->allocation.height + BORDER;
@@ -1466,10 +1556,12 @@
}
static void
-remove_panel (GtkWidget * w, PanelManagerDialog * pmd)
+remove_panel (GtkWidget *w,
+ PanelManagerDialog *pmd)
{
- int n = pmd->panels->len;
- int i;
+ gint n = pmd->panels->len;
+ gint i;
+ gchar name[20];
panel_app_remove_panel (GTK_WIDGET (pmd->panel));
@@ -1483,8 +1575,6 @@
for (i = 0; i < pmd->panels->len; ++i)
{
- char name[20];
-
g_snprintf (name, 20, _("Panel %d"), i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->panel_selector), name);
@@ -1497,7 +1587,8 @@
create_panel_selector (PanelManagerDialog *pmd)
{
GtkWidget *hbox, *img;
- int i;
+ gint i;
+ gchar name[20];
hbox = gtk_hbox_new (FALSE, BORDER);
gtk_widget_show (hbox);
@@ -1508,8 +1599,6 @@
for (i = 0; i < pmd->panels->len; ++i)
{
- char name[20];
-
g_snprintf (name, 20, _("Panel %d"), i + 1);
gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->panel_selector), name);
@@ -1518,9 +1607,9 @@
gtk_combo_box_set_active (GTK_COMBO_BOX (pmd->panel_selector),
pmd->current);
- g_signal_connect (pmd->panel_selector, "changed",
+ g_signal_connect (G_OBJECT (pmd->panel_selector), "changed",
G_CALLBACK (panel_selected), pmd);
-
+
pmd->rm_panel = gtk_button_new ();
gtk_widget_show (pmd->rm_panel);
gtk_box_pack_start (GTK_BOX (hbox), pmd->rm_panel, FALSE, FALSE, 0);
@@ -1531,9 +1620,9 @@
gtk_tooltips_set_tip (pmd->tips, pmd->rm_panel, _("Remove Panel"), NULL);
- g_signal_connect (pmd->rm_panel, "clicked",
+ g_signal_connect (G_OBJECT (pmd->rm_panel), "clicked",
G_CALLBACK (remove_panel), pmd);
-
+
pmd->add_panel = gtk_button_new ();
gtk_widget_show (pmd->add_panel);
gtk_box_pack_start (GTK_BOX (hbox), pmd->add_panel, FALSE, FALSE, 0);
@@ -1544,26 +1633,29 @@
gtk_tooltips_set_tip (pmd->tips, pmd->add_panel, _("New Panel"), NULL);
- g_signal_connect (pmd->add_panel, "clicked", G_CALLBACK (add_panel), pmd);
+ g_signal_connect (G_OBJECT (pmd->add_panel), "clicked",
+ G_CALLBACK (add_panel), pmd);
return hbox;
}
/* main dialog */
static void
-panel_dialog_response (GtkWidget *dlg, int response, PanelManagerDialog *pmd)
+panel_dialog_response (GtkWidget *dlg,
+ gint response,
+ PanelManagerDialog *pmd)
{
if (response != GTK_RESPONSE_HELP)
{
panel_dialog_widget = NULL;
-
+
if (pmd->monitors)
g_ptr_array_free (pmd->monitors, TRUE);
-
+
g_ptr_array_foreach (pmd->panels, (GFunc)panel_unblock_autohide, NULL);
-
+
gtk_widget_destroy (dlg);
-
+
g_object_unref (G_OBJECT (pmd->tips));
panel_slice_free (PanelManagerDialog, pmd);
@@ -1571,7 +1663,7 @@
}
else
{
- xfce_exec_on_screen (gtk_widget_get_screen (dlg),
+ xfce_exec_on_screen (gtk_widget_get_screen (dlg),
"xfhelp4 panel.html", FALSE, FALSE, NULL);
}
}
@@ -1580,26 +1672,26 @@
panel_manager_dialog (GPtrArray *panels)
{
PanelManagerDialog *pmd;
- GtkWidget *vbox, *sel;
- Panel *panel;
+ GtkWidget *vbox, *sel;
+ Panel *panel;
if (panel_dialog_widget)
{
present_dialog (panel_dialog_widget, panels);
return;
}
-
+
pmd = panel_slice_new0 (PanelManagerDialog);
/* panels */
pmd->panels = panels;
pmd->current = panel_app_get_current_panel();
- panel = pmd->panel =
+ panel = pmd->panel =
g_ptr_array_index (panels, pmd->current);
/* main dialog widget */
- panel_dialog_widget = pmd->dlg =
- xfce_titled_dialog_new_with_buttons (_("Panel Manager"), NULL,
+ panel_dialog_widget = pmd->dlg =
+ xfce_titled_dialog_new_with_buttons (_("Panel Manager"), NULL,
GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
@@ -1615,11 +1707,11 @@
vbox = gtk_vbox_new (FALSE, 8);
gtk_widget_show (vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pmd->dlg)->vbox), vbox,
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (pmd->dlg)->vbox), vbox,
TRUE, TRUE, 0);
pmd->updating = TRUE;
-
+
/* add/remove/rename panel */
sel = create_panel_selector (pmd);
gtk_widget_show (sel);
@@ -1643,16 +1735,12 @@
g_ptr_array_foreach (pmd->panels, (GFunc)panel_block_autohide, NULL);
/* setup and show dialog */
- g_signal_connect (pmd->dlg, "response",
+ g_signal_connect (G_OBJECT (pmd->dlg), "response",
G_CALLBACK (panel_dialog_response), pmd);
-
+
gtk_window_stick(GTK_WINDOW (pmd->dlg));
xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (pmd->dlg));
- gtk_widget_realize (pmd->dlg);
- /* window needs to be realized */
- gdk_x11_window_set_user_time (GTK_WIDGET (pmd->dlg)->window,
- gdk_x11_get_server_time (GTK_WIDGET (pmd->dlg)->window));
gtk_widget_show (pmd->dlg);
panel_app_register_dialog (pmd->dlg);
Modified: xfce4-panel/trunk/panel/panel-dialogs.h
===================================================================
--- xfce4-panel/trunk/panel/panel-dialogs.h 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-dialogs.h 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,29 +1,27 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _PANEL_DIALOGS_H
-#define _PANEL_DIALOGS_H
+#ifndef __PANEL_DIALOGS_H__
+#define __PANEL_DIALOGS_H__
void add_items_dialog (GPtrArray *panels, GtkWidget *active_item);
void panel_manager_dialog (GPtrArray *panels);
-#endif /* _PANEL_DIALOGS_H */
+#endif /* !__PANEL_DIALOGS_H__ */
Modified: xfce4-panel/trunk/panel/panel-dnd.c
===================================================================
--- xfce4-panel/trunk/panel/panel-dnd.c 2007-03-03 19:32:33 UTC (rev 25078)
+++ xfce4-panel/trunk/panel/panel-dnd.c 2007-03-03 19:54:22 UTC (rev 25079)
@@ -1,22 +1,20 @@
-/* vim: set expandtab ts=8 sw=4: */
-
-/* $Id$
+/* $Id$
*
- * Copyright © 2005 Jasper Huijsmans <jasper at xfce.org>
+ * Copyright (c) 2005 Jasper Huijsmans <jasper at xfce.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program 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 Library General Public License for more details.
+ * This program 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 Library General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
@@ -27,58 +25,51 @@
#include "panel-dnd.h"
-/* Partly based on the example on
+/* Partly based on the example on
* http://live.gnome.org/GnomeLove/DragNDropTutorial
* Copyright © 2005 Ryan McDougall
* Licensed under the GNU GPL
*/
-static const GtkTargetEntry dest_target_list[] =
+static const GtkTargetEntry dest_target_list[] =
{
{ "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME },
- { "application/x-xfce-panel-plugin-widget",
- GTK_TARGET_SAME_APP, TARGET_PLUGIN_WIDGET },
+ { "application/x-xfce-panel-plugin-widget", 0, TARGET_PLUGIN_WIDGET },
{ "text/plain", 0, TARGET_FILE },
{ "text/uri-list", 0, TARGET_FILE },
{ "UTF8_STRING", 0, TARGET_FILE }
};
-static const guint n_dest_targets = G_N_ELEMENTS (dest_target_list);
-
-static const GtkTargetEntry name_target_list[] =
+static const GtkTargetEntry name_target_list[] =
{
{ "application/x-xfce-panel-plugin-name", 0, TARGET_PLUGIN_NAME }
};
-static const guint n_name_targets = G_N_ELEMENTS (name_target_list);
-
-static const GtkTargetEntry widget_target_list[] =
+static const GtkTargetEntry widget_target_list[] =
{
{ "application/x-xfce-panel-plugin-widget", 0, TARGET_PLUGIN_WIDGET }
};
-static guint n_widget_targets = G_N_ELEMENTS (widget_target_list);
-
/* public API */
-void
+void
panel_dnd_set_dest (GtkWidget *widget)
{
- gtk_drag_dest_set (widget,
+ gtk_drag_dest_set (widget,
GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION,
- dest_target_list, n_dest_targets, GDK_ACTION_COPY);
+ dest_target_list, G_N_ELEMENTS (dest_target_list), GDK_ACTION_COPY);
}
-void
+void
panel_dnd_set_widget_delete_dest (GtkWidget *widget)
{
- gtk_drag_dest_set (widget,
+ gtk_drag_dest_set (widget,
GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION,
- widget_target_list, n_widget_targets,
+ widget_target_list, G_N_ELEMENTS (widget_target_list),
GDK_ACTION_MOVE);
}
-void
+void
panel_dnd_unset_dest (GtkWidget *widget)
{
gtk_drag_dest_unset (widget);
@@ -91,23 +82,23 @@
n = (glong *)data->data;
DBG (" + get pointer: %ld", *n);
-
+
return GTK_WIDGET (GINT_TO_POINTER (*n));
}
-void
+void
panel_dnd_set_name_source (GtkWidget *widget)
{
- gtk_drag_source_set (widget, GDK_BUTTON1_MASK,
- name_target_list, n_name_targets,
+ gtk_drag_source_set (widget, GDK_BUTTO