Browse Source

* panel/main.c, panel/panel-app.{c,h}: Fix problem with session management

and move the last lines of code from the 4_5_nick branch to trunk.
	  file is different in the branch because it contains a problem that

(Old svn revision: 25108)
upstream/xfce4-panel-4.10.1
Nick Schermer 16 years ago
parent
commit
b2e281f6fd
  1. 137
      ChangeLog
  2. 233
      panel/main.c
  3. 26
      panel/panel-app.c
  4. 2
      panel/panel-app.h

137
ChangeLog

@ -1,7 +1,12 @@
2007-03-04 16:14 nick
* panel/main.c, panel/panel-app.{c,h}: Fix problem with session management
and move the last lines of code from the 4_5_nick branch to trunk.
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
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
@ -53,14 +58,14 @@
* xfdesktop
* xfprint
* xfwm4
Also thus updated appropriate ChangeLog files.
2007-01-18 09:44 nab
* po/ChangeLog, po/be.po: 2007-01-18 Alexander Nyakhaychyk
<nyakhaychyk@gmail.com>
* be.po: Updated Belarusian Translation
2007-01-09 13:10 maximilian
@ -150,7 +155,7 @@
monitors. I've simply removed the code for moving the dialog to
the other window, because I couldn't find a way to make this work
propery.
The panel doesn't crash anymore, but there are still some drawing
issues when switching monitors.
@ -320,7 +325,7 @@
plugins/testplugin,
po/POTFILES.in, *.po*: Remove the testplugin from the panel. You
can find a sample plugin the the goodies repository.
PS. First commit in the Xfce SVN ^_^
2006-12-17 18:45 sas
@ -663,7 +668,7 @@
xfprint/trunk/po/dz.po, xfwm4/trunk/po/ChangeLog,
xfwm4/trunk/po/LINGUAS, xfwm4/trunk/po/dz.po: added whole
Dzongkha translation
congratulations to the dz team.
2006-10-24 21:47 olivier
@ -1472,7 +1477,7 @@
* configure.in.in -> configure.ac.in (hey Brian ;-)
* Make config files translatable, but don't update po files yet:
it will probably still change.
2006-06-04 08:12 eulex
@ -2354,7 +2359,7 @@
2006-04-26 09:29 mvd
* po/uk.po: 2006-04-26 Maxim Dziumanenko <mvd@mylinux.ua>
* Updated Ukrainian translation.
2006-04-26 08:38 peetervois
@ -6869,7 +6874,7 @@
xffm/trunk/xffm-gui/po/ca.po, xfprint/trunk/po/ca.po,
xfwm4/trunk/po/ca.po: begin process to 4.4 work
autotranslation of most of the actual po
-- paurullan@bulma.net , ca translator
2005-10-24 07:11 piarres
@ -6944,7 +6949,7 @@
dialogs
* Adjust menus accordingly
* Add grippy cursor from libexo
This could probably use some testing.
2005-10-20 12:37 alex
@ -7380,7 +7385,7 @@
po/vi.po, po/zh_CN.po, po/zh_TW.po: * Updated and bumped version
at the `Project-Id-Version'.
- この行以下は無視されます --
M ar.po
M az.po
M be.po
@ -7611,13 +7616,13 @@
po/ru.po, po/sk.po, po/sv.po, po/ta.po, po/tr.po, po/uk.po,
po/vi.po, po/zh_CN.po, po/zh_TW.po: * Bumped version at the
"Project-Id-Version: ".
* Discarded obsolete translations.
* Added fall back address at the "Language-Team: ", according to
the
http://www.iro.umontreal.ca/translation/registry.cgi?team=index
* Modified initial comment strings using template by "msginit".
2005-09-29 11:53 daichi
@ -7757,7 +7762,7 @@
xfce4-trigger-launcher/trunk/po/ja.po, xfdesktop/trunk/po/ja.po,
xfprint/trunk/po/ja.po, xfwm4/trunk/po/ja.po: * Added initial
"$Id$".
* Updated some translations.
2005-09-08 15:42 hydonsingore
@ -7806,13 +7811,13 @@
po/ms.po, po/sv.po, po/ta.po: Added missing '\n', which causes
parsing error at
http://xfce.org/~kelnos/xfce4/i18n/
Added fall back address at the 'Language-Team: ', according to
the
http://www.iro.umontreal.ca/translation/registry.cgi?team=index
Modified initial comment strings with template by 'msginit'.
Discarded obsolete translations.
2005-08-18 12:05 daichi
@ -7836,11 +7841,11 @@
* po/bg.po, po/es.po, po/es_MX.po, po/nb_NO.po, po/nl.po,
po/pt_BR.po, po/sv.po, po/zh_CN.po: Fixed errors emitted by
'msgfmt -c'.
Added fall back address at the 'Language-Team: ', according to
the
http://www.iro.umontreal.ca/translation/registry.cgi?team=index
Modified initial comment strings with template by 'msginit'.
2005-08-17 15:03 daichi
@ -8244,7 +8249,7 @@
* remove popup position global option
* other stuff (it's a pretty big change, so I'm sure i forgot
something ;-)
Please tell me if it breaks anything.
2005-05-07 12:27 jasper
@ -8563,7 +8568,7 @@
* XfceItem : simple container to add to an itembar
* XfceSeparatorItem : special XfceItem that simply shows a
separator
* Make panel controls and separator item plugin use the new
widgets.
* Make taskbar use new widgets
@ -11365,11 +11370,11 @@
CVS history here, but for completeness sake I'm including the
ChangeLog
entries here:
+++
2003-10-11 00:08 edscott
* xffm/src/: add_folder.c, add_node_contents.c, callbacks.c,
keybindings.c, main.c, treeview.c: do second letter search if
first
@ -11380,9 +11385,9 @@
--DONE g_strchug() crash on openwith by menu... --FIXED on go_up
do
not place in history, nor back nor forward --DONE
2003-10-11 00:05 edscott
* xffm/: libs/apps.c, libs/bookmarks.c, libs/constants.h,
libs/cpy.c, libs/dnd.c, libs/dummies.c, libs/duplicate.c,
libs/entry.c, libs/goto.c, libs/goto.h, libs/icons.c,
@ -11400,14 +11405,14 @@
openwith
by menu... --FIXED on go_up do not place in history, nor back nor
forward --DONE
2003-10-10 23:19 xfce
* xfce-utils/scripts/xinitrc: Don't use cpp in xrdb so that DPI
settings load even on workstations w/out cpp
2003-10-10 22:17 xfce
* libxfcegui4/libxfcegui4/netk-pager.c, xfwm4/configure,
xfwm4/configure.ac, xfwm4/themes/Makefile.am,
xfwm4/themes/Makefile.in, xfwm4/themes/default/bottom-active.xpm,
@ -11464,23 +11469,23 @@
xfwm4/themes/default/top-right-inactive.xpm: Revert xfwm4 default
theme to the one found in pre-release as it looked better Fix a
very small thing in netk-pager
2003-10-10 19:21 huysmans
* xfce4/plugins/pager/pager.c: Fix resizing bug
2003-10-09 23:41 huysmans
* xfwm4/: mcs-plugin/workspaces.c, src/settings.c: Move workspace
names settings into settings plugin. Rename count to
Xfwm/WorkspaceCount for consistency.
2003-10-09 23:03 xfce
* libxfcegui4/: configure, configure.ac: Increase version number
2003-10-09 22:13 xfce
* xfwm4/themes/default/: close-active.xpm, close-inactive.xpm,
close-pressed.xpm, hide-active.xpm, hide-inactive.xpm,
hide-pressed.xpm, maximize-active.xpm, maximize-inactive.xpm,
@ -11495,14 +11500,14 @@
title-2-active.xpm, title-2-inactive.xpm, title-3-active.xpm,
title-3-inactive.xpm, title-4-active.xpm, title-4-inactive.xpm:
Change default theme for 4.2
2003-10-09 15:19 edscott
* xffm/: glade_intl, src/glade_callbacks.h, src/glade_gui.c.bak,
src/glade_gui.h: remove obsolete files
2003-10-09 07:04 edscott
* xffm/src/: Makefile.am, Makefile.in, callbacks.c,
keybindings.c,
keybindings.h, treeview.c, treeview.h: scroll by keyboard is now
@ -11510,9 +11515,9 @@
proceed
backwards. Backward scroll-search will not wrap. Forward
scroll-sear ch will wrap (as before).
2003-10-09 04:14 edscott
* xffm/: glade/xffm_main.glade, libs/apps.c, libs/bookmarks.c,
libs/combo.c, libs/cpy.c, libs/dummies.c, libs/duplicate.c,
libs/entry.c, libs/filter.c, libs/find.h, libs/goto.c,
@ -11525,9 +11530,9 @@
smb/smb_download.c, smb/smb_list.c, src/glade_main_gui.c,
src/main.c, src/treeview.c, src/widgets.c: eliminate all warnings
when compiling with --enable-debug
2003-10-09 01:46 edscott
* xffm/: xffm.glade, xffm.gladep, glade/xffm_find.glade,
glade/xffm_find.gladep, glade/xffm_main.glade,
glade/xffm_main.gladep, glade/xffm_remove.glade,
@ -11554,22 +11559,22 @@
src/glade_remove_callbacks.h, src/glade_remove_gui.c,
src/glade_remove_gui.h, src/main.c, src/mcs-manager.c,
src/treeview.c, src/widgets.c: broke glade files into three parts
2003-10-08 23:43 xfce
* xfwm4/src/: client.c, events.c, settings.c: [no log message]
2003-10-08 22:29 xfce
* xfwm4/themes/default.keys/keythemerc: Change raise/lower key
2003-10-08 22:24 xfce
* xfwm4/: src/settings.c, themes/default.keys/keythemerc: Fix
raise/lower key shortcut patch
2003-10-08 22:12 xfce
* xfwm4/: configure, configure.ac, themes/Makefile.am,
themes/Makefile.in, themes/default/title-2-active.xpm,
themes/default/title-2-inactive.xpm,
@ -11577,9 +11582,9 @@
themes/default/title-4-inactive.xpm,
themes/default/top-right-active.xpm,
themes/default/top-right-inactive.xpm: Add missing files
2003-10-08 10:20 huysmans
* xfdesktop/doc/C/xfdesktop.html, xfdesktop/doc/C/xfdesktop.xml,
xfdesktop/doc/C/images/Makefile.am,
xfdesktop/doc/C/images/Makefile.in,
@ -11601,22 +11606,22 @@
update:
merge workspaces dialog from xfdesktop with workspace margins
dialog from xfwm4. The new dialog is part of xfwm4.
2003-10-07 22:44 xfce
* libxfcegui4/libxfcegui4/: Makefile.am, Makefile.in,
netk-class-group.c, netk-class-group.h, netk-private.h,
netk-screen.c, netk-screen.h, netk-tasklist.c, netk-window.c,
netk-window.h, netk-xutils.c, netk-xutils.h: Backport changes
from
libwnck HEAD cvs
2003-10-07 22:40 xfce
* xffm/libs/: input.c, run.c: Include Edscott patches
2003-10-07 22:31 xfce
* xfwm4/: configure, configure.ac, src/client.c, src/events.c,
themes/Makefile.am, themes/Makefile.in,
themes/default/bottom-active.xpm,
@ -11698,7 +11703,7 @@
old 4.0 theme as default-4.0 and add tgc-large theme Include
improvements for fullscreen mode for gst from Arwed von Merkatz
<v.merkatz@gmx.net>
+++
2003-09-30 20:53 huysmans
@ -13119,7 +13124,7 @@
themes/Gnome/Makefile.in, themes/Makefile.in,
themes/Noia/Makefile.in, themes/XFce/Makefile.in: Improved
debug.m4:
1) --disable-debug no longer disables assert()'s
2) --enable-profiling now enables profiling code
3) --disable-asserts allows disabling of assert()'s
@ -15548,7 +15553,7 @@
settings.c, settings.h, side.c, side.h, wmhints.c, wmhints.h,
xfce.c, xfce.h: Add gtk2 based panel
2002-05-20 14:56
2002-05-20 14:56
* xfce4-panel/branches, xfce4-panel/tags, .: New repository
initialized by cvs2svn.

233
panel/main.c

@ -1,32 +1,39 @@
/* vim: set expandtab ts=8 sw=4: */
/* $Id$
/* $Id$
*
* Copyright © 2005 Jasper Huijsmans <jasper@xfce.org>
* Copyright (c) 2005 Jasper Huijsmans <jasper@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_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
@ -37,142 +44,112 @@
#define _(x) x
#endif
/* handle options */
static void
version_and_usage (void)
/* globals */
static gboolean opt_version = FALSE;
static gboolean opt_customize = FALSE;
static gboolean opt_save = FALSE;
static gboolean opt_restart = FALSE;
static gboolean opt_quit = FALSE;
static gboolean opt_exit = FALSE;
static gboolean opt_add = FALSE;
static gchar *opt_client_id = NULL;
/* command line options */
static GOptionEntry option_entries[] =
{
setlocale(LC_ALL, "");
g_print (_("\n"
" Xfce Panel %s\n\n"
" Part of the Xfce Desktop Environment\n"
" http://www.xfce.org\n\n"
" Licensed under the GNU GPL.\n\n"), VERSION);
g_print (_(" Usage: %s [OPTIONS]\n\n"), PACKAGE);
/* Only translate the descriptions, not the options itself */
g_print (_(" OPTIONS\n"
" -h, --help Show this message and exit\n"
" -v, --version Show this message and exit\n"
" -c, --customize Show configuration dialog\n"
" -s, --save Save configuration\n"
" -r, --restart Restart panels\n"
" -q, --quit End the session\n"
" -x, --exit Close all panels and end the program\n"
" -a, --add Add new items\n\n"
));
}
{ "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, N_ ("Show this message and exit"), NULL },
{ "customize", 'c', 0, G_OPTION_ARG_NONE, &opt_customize, N_ ("Show configuration dialog"), NULL },
{ "save", 's', 0, G_OPTION_ARG_NONE, &opt_save, N_ ("Save configuration"), NULL },
{ "restart", 'r', 0, G_OPTION_ARG_NONE, &opt_restart, N_ ("Restart panels"), NULL },
{ "quit", 'q', 0, G_OPTION_ARG_NONE, &opt_quit, N_ ("End the session"), NULL },
{ "exit", 'x', 0, G_OPTION_ARG_NONE, &opt_exit, N_ ("Close all panels and end the program"), NULL },
{ "add", 'a', 0, G_OPTION_ARG_NONE, &opt_add, N_ ("Add new items"), NULL },
{ "sm-client-id", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_client_id, NULL, NULL },
{ NULL }
};
static gboolean
handle_options (int argc, char **argv, int *success)
/* main program */
gint
main (gint argc, gchar **argv)
{
gboolean handled = FALSE;
gint msg = -1;
GError *error = NULL;
*success = 0;
/* translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
if (argc > 1 && argv[1][0] == '-')
{
/* help / version */
if (!strcmp (argv[1], "-h") ||
!strcmp (argv[1], "-v") ||
!strcmp (argv[1], "--help") ||
!strcmp (argv[1], "--version"))
{
handled = TRUE;
version_and_usage ();
}
else
{
int msg = -1;
if (!strcmp (argv[1], "-c") ||
!strcmp (argv[1], "--customize"))
{
handled = TRUE;
msg = PANEL_APP_CUSTOMIZE;
}
else if (!strcmp (argv[1], "-s") ||
!strcmp (argv[1], "--save"))
{
handled = TRUE;
msg = PANEL_APP_SAVE;
}
else if (!strcmp (argv[1], "-r") ||
!strcmp (argv[1], "--restart"))
{
handled = TRUE;
msg = PANEL_APP_RESTART;
}
else if (!strcmp (argv[1], "-q") ||
!strcmp (argv[1], "--quit"))
{
handled = TRUE;
msg = PANEL_APP_QUIT;
}
else if (!strcmp (argv[1], "-x") ||
!strcmp (argv[1], "--exit"))
{
handled = TRUE;
msg = PANEL_APP_EXIT;
}
else if (!strcmp (argv[1], "-a") ||
!strcmp (argv[1], "--add"))
{
handled = TRUE;
msg = PANEL_APP_ADD;
}
if (msg >= 0)
{
gtk_init (&argc, &argv);
panel_app_send (msg);
}
}
}
/* application name */
g_set_application_name (PACKAGE_NAME);
return handled;
}
TIMER_ELAPSED ("start gtk_init_with_args ()");
/* main program */
/* initialize gtk */
if (!gtk_init_with_args (&argc, &argv, "", option_entries, GETTEXT_PACKAGE, &error))
{
g_print ("%s: %s\n", PACKAGE_NAME, error ? error->message : _("Failed to open display"));
int
main (int argc, char **argv)
{
int success = 0;
if (error != NULL)
g_error_free (error);
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
return EXIT_FAILURE;
}
if (handle_options (argc, argv, &success))
exit (success);
/* handle the options */
if (G_UNLIKELY (opt_version))
{
g_print ("%s %s (Xfce %s)\n\n", PACKAGE_NAME, PACKAGE_VERSION, xfce_version_string ());
g_print ("%s\n", _("Copyright (c) 2004-2007"));
g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));
g_print (_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
g_print ("\n");
return EXIT_SUCCESS;
}
else if (G_UNLIKELY (opt_customize))
msg = PANEL_APP_CUSTOMIZE;
else if (G_UNLIKELY (opt_save))
msg = PANEL_APP_SAVE;
else if (G_UNLIKELY (opt_restart))
msg = PANEL_APP_RESTART;
else if (G_UNLIKELY (opt_quit))
msg = PANEL_APP_QUIT;
else if (G_UNLIKELY (opt_exit))
msg = PANEL_APP_EXIT;
else if (G_UNLIKELY (opt_add))
msg = PANEL_APP_ADD;
/* handle the message, if there is any */
if (G_UNLIKELY (msg >= 0))
{
panel_app_send (msg);
TIMER_ELAPSED("start gtk_init()");
gtk_init (&argc, &argv);
return EXIT_SUCCESS;
}
TIMER_ELAPSED("start panel_init()");
success = panel_app_init ();
TIMER_ELAPSED ("start panel_init()");
msg = panel_app_init ();
if (success == -1)
if (G_UNLIKELY (msg == -1))
{
return 1;
return EXIT_FAILURE;
}
else if (success == 1)
else if (G_UNLIKELY (msg == 1))
{
g_message ("%s already running", PACKAGE);
return 0;
g_message (_("xfce4-panel already running"));
return EXIT_SUCCESS;
}
TIMER_ELAPSED("start panel_app_run()");
success = panel_app_run (argc, argv);
TIMER_ELAPSED ("start panel_app_run()");
msg = panel_app_run (opt_client_id);
if (success == 1)
if (G_UNLIKELY (msg == 1))
{
/* restart */
g_message ("Restarting %s...", argv[0]);
g_message (_("Restarting xfce4-panel..."));
execvp (argv[0], argv);
}
return success;
return EXIT_SUCCESS;
}

26
panel/panel-app.c

@ -631,15 +631,15 @@ panel_app_init_panel (GtkWidget *panel)
* Returns: 1 to restart and 0 to quit.
**/
gint
panel_app_run (gint argc,
gchar **argv)
panel_app_run (gchar *client_id)
{
#ifdef HAVE_SIGACTION
struct sigaction act;
#endif
GIOChannel *g_signal_in;
GError *error = NULL;
glong fd_flags;
GIOChannel *g_signal_in;
GError *error = NULL;
glong fd_flags;
gchar **restart_command;
/* create pipe and set writing end in non-blocking mode */
if (pipe (signal_pipe))
@ -712,14 +712,18 @@ panel_app_run (gint argc,
#endif
/* environment */
xfce_setenv ("DISPLAY", gdk_display_get_name (gdk_display_get_default ()),
TRUE);
xfce_setenv ("DISPLAY", gdk_display_get_name (gdk_display_get_default ()), TRUE);
/* session management */
panel_app.session_client =
client_session_new (argc, argv, NULL /* data */,
SESSION_RESTART_IF_RUNNING, 40);
restart_command = g_new (gchar *, 2);
restart_command[0] = "xfce4-panel";
restart_command[1] = "-r";
restart_command[2] = NULL;
panel_app.session_client = client_session_new_full (NULL, SESSION_RESTART_IF_RUNNING,
40, client_id, PACKAGE_NAME, NULL,
restart_command, restart_command,
NULL, NULL, NULL);
panel_app.session_client->save_yourself = session_save_yourself;
panel_app.session_client->die = session_die;

2
panel/panel-app.h

@ -57,7 +57,7 @@ struct _XfceMonitor
int panel_app_init (void);
int panel_app_run (int argc, char **argv);
int panel_app_run (gchar *client_id);
void panel_app_queue_save (void);

Loading…
Cancel
Save