summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2003-07-08 22:30:51 +0000
committerBenedikt Meurer <benny@xfce.org>2003-07-08 22:30:51 +0000
commitb9dd3daeeaf2044fe04e2b58757fbf84a6d72e07 (patch)
tree35ed7be02a5dab9cff6c522efba60bd6662cd98a
parent097cb6c1ec45b0bd50a0051946e4f55d9566dcf6 (diff)
downloadxfce4-session-b9dd3daeeaf2044fe04e2b58757fbf84a6d72e07.tar.gz
Additional notes and ChangeLog updated.
(Old svn revision: 4439)
-rw-r--r--ChangeLog6
-rw-r--r--NEWS3
-rw-r--r--TODO9
-rwxr-xr-xdefaults/default.session1
-rw-r--r--po/xfce4-session.pot12
-rw-r--r--xfce4-session/main.c24
-rw-r--r--xfce4-session/manager.c7
-rw-r--r--xfce4-session/manager.h1
-rw-r--r--xfce4-session/tray-icon.c39
-rw-r--r--xfce4-session/tray-icon.h8
10 files changed, 77 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 33307306..bf783d55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-08 23:20 bmeurer
+
+ * ChangeLog, po/xfce4-session.pot, xfce4-session/ice-layer.c:
+ Client was not removed from "session control" if an ICE error
+ occurred.
+
2003-07-08 23:05 bmeurer
* NEWS, configure, configure.ac, xfce4-session/Makefile.am,
diff --git a/NEWS b/NEWS
index 806ee2f8..ded0b882 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@
xfce4-session by default if installed.
* Added "session control" dialog and tray icon. Made several
improvements. Now requires libxfcegui4 >= 3.92.2
+ * smproxy now works with xfce4-session, that says, X11R5 session
+ apps are now managed by the session manager as well (e.g. xcalc,
+ xedit, xbiff or even apps like gimp and gqview)
20030707:
---------
diff --git a/TODO b/TODO
index f0204535..65de38ae 100644
--- a/TODO
+++ b/TODO
@@ -6,9 +6,16 @@
* Save session on SIGHUP -> SaveYourself checkpoint
* Save to XML instead of this binary format.
* Add a systray icon to configure the manager "online". E.g. having a
- menu item "Save session now" to issue a SaveYourself request.
+ menu item "Save session now" to issue a SaveYourself request. (Part. done)
* Honor SmRestartStyleHint
+ * Should we move XfsmTrayIcon to libxfcegui4? It provides a nice way to
+ use NetkTrayIcon, and provides the basic functionality all tray icons
+ use.
+
+ * Try to translate userids provided by smproxy to usernames if hostnames
+ match.
+
MCS-plugin:
-----------
diff --git a/defaults/default.session b/defaults/default.session
index fe114952..9ac3386f 100755
--- a/defaults/default.session
+++ b/defaults/default.session
@@ -1,5 +1,6 @@
#!/bin/sh
+smproxy &
xfwm4 --daemon
xftaskbar4 &
xfdesktop &
diff --git a/po/xfce4-session.pot b/po/xfce4-session.pot
index 3e24adf3..45093836 100644
--- a/po/xfce4-session.pot
+++ b/po/xfce4-session.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2003-07-08 23:05+0200\n"
+"POT-Creation-Date: 2003-07-09 00:04+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -115,11 +115,11 @@ msgid ""
msgstr ""
#.
-#: xfce4-session/main.c:255
+#: xfce4-session/main.c:254
msgid "Session control"
msgstr ""
-#: xfce4-session/main.c:293
+#: xfce4-session/main.c:305
msgid ""
"The session manager was unable to start the\n"
"Multi-Channel settings manager. This is most\n"
@@ -128,18 +128,18 @@ msgid ""
"and report the problem."
msgstr ""
-#: xfce4-session/main.c:306
+#: xfce4-session/main.c:318
msgid "Unable to create MCS client"
msgstr ""
-#: xfce4-session/manager.c:314
+#: xfce4-session/manager.c:313
msgid ""
"The session manager was unable to restore your\n"
"previous session. It'll therefore start a default\n"
"session."
msgstr ""
-#: xfce4-session/manager.c:776
+#: xfce4-session/manager.c:773
#, c-format
msgid ""
"The client \"%s\" closed the connection\n"
diff --git a/xfce4-session/main.c b/xfce4-session/main.c
index dc625baa..3d0a5808 100644
--- a/xfce4-session/main.c
+++ b/xfce4-session/main.c
@@ -236,7 +236,6 @@ create_tray_icon(void)
{
/* XXX */
extern GtkWidget *clientList;
- GtkWidget *defaultItem;
GtkWidget *menuItem;
GtkWidget *menu;
GtkWidget *icon;
@@ -252,13 +251,20 @@ create_tray_icon(void)
gtk_widget_show(menuItem);
/* */
- defaultItem = gtk_menu_item_new_with_mnemonic(_("Session control"));
- g_signal_connect_swapped(defaultItem, "activate",
+ menuItem = gtk_menu_item_new_with_mnemonic(_("Session control"));
+ g_signal_connect_swapped(menuItem, "activate",
+ G_CALLBACK(gtk_widget_show), clientList);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItem);
+ gtk_widget_show(menuItem);
+
+ icon = xfsm_tray_icon_new(GTK_MENU(menu));
+
+ /* connect the double action */
+ g_signal_connect_swapped(G_OBJECT(icon), "clicked",
G_CALLBACK(toggle_visible), clientList);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), defaultItem);
- gtk_widget_show(defaultItem);
- icon = xfsm_tray_icon_new(GTK_MENU(menu), defaultItem);
+ /* the tray icon now keeps a ref on the menu */
+ g_object_unref(G_OBJECT(menu));
return(icon);
}
@@ -276,6 +282,12 @@ main(int argc, char **argv)
gtk_init(&argc, &argv);
+ /*
+ * fake a clientID for the manager, so smproxy does not recognize
+ * us to be a session client
+ */
+ gdk_set_sm_client_id(manager_generate_client_id(NULL));
+
/* run a sanity check before we start the actual session manager */
if (!sanity_check(&message)) {
xfce_err("%s", message);
diff --git a/xfce4-session/manager.c b/xfce4-session/manager.c
index f57450aa..3d6ab25e 100644
--- a/xfce4-session/manager.c
+++ b/xfce4-session/manager.c
@@ -97,7 +97,6 @@ static IceListenObj *listenObjs;
GtkWidget *clientList = NULL;
/* prototypes */
-static char *manager_generate_client_id(SmsConn);
static Status new_client(SmsConn, SmPointer, unsigned long *, SmsCallbacks *,
char **);
static Status register_client(SmsConn, Client *, char *);
@@ -321,16 +320,14 @@ end:
/*
* Safe way to generate a client id, in case SmsGenerateClientID() fails
*/
-static char *
+char *
manager_generate_client_id(SmsConn smsConn)
{
static char *addr = NULL;
static int sequence = 0;
char *id;
- if ((id = SmsGenerateClientID(smsConn)) == NULL) {
- g_warning("SmsGenerateClientID() failed, faking client id");
-
+ if (smsConn == NULL || (id = SmsGenerateClientID(smsConn)) == NULL) {
if (addr == NULL) {
/*
* Faking our IP address, the 0 below is "unknown"
diff --git a/xfce4-session/manager.h b/xfce4-session/manager.h
index 1dc7199e..8f69bbd0 100644
--- a/xfce4-session/manager.h
+++ b/xfce4-session/manager.h
@@ -51,5 +51,6 @@ extern gboolean shutdownSave;
extern gboolean manager_init(void);
extern gboolean manager_save(void);
extern gboolean manager_restart(void);
+extern gchar *manager_generate_client_id(SmsConn);
#endif /* !__XFSM_MANAGER_H__ */
diff --git a/xfce4-session/tray-icon.c b/xfce4-session/tray-icon.c
index 1ba76282..34be0689 100644
--- a/xfce4-session/tray-icon.c
+++ b/xfce4-session/tray-icon.c
@@ -34,6 +34,13 @@
#include <settings/session-icon.h>
#include <xfce4-session/tray-icon.h>
+/* signals provided by the tray icon */
+enum
+{
+ CLICKED, /* user double-clicked the icon */
+ LAST_SIGNAL
+};
+
/* static prototypes */
static void xfsm_tray_icon_class_init(XfsmTrayIconClass *);
static void xfsm_tray_icon_init(XfsmTrayIcon *);
@@ -42,6 +49,9 @@ static void xfsm_tray_icon_finalize(GObject *);
/* parent class */
static GObjectClass *parent_class;
+/* tray icon signals */
+static guint tray_signals[LAST_SIGNAL];
+
/*
*/
GType
@@ -79,9 +89,23 @@ xfsm_tray_icon_class_init(XfsmTrayIconClass *klass)
{
GObjectClass *gobject_class;
+ parent_class = gtk_type_class(netk_tray_icon_get_type());
+
gobject_class = G_OBJECT_CLASS(klass);
gobject_class->finalize = xfsm_tray_icon_finalize;
- parent_class = gtk_type_class(netk_tray_icon_get_type());
+
+ /*
+ * create signals
+ */
+ tray_signals[CLICKED] = g_signal_new("clicked",
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(XfsmTrayIconClass, clicked),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
}
/*
@@ -94,12 +118,7 @@ xfsm_tray_icon_press(XfsmTrayIcon *icon, GdkEventButton *event, gpointer data)
g_return_if_fail(GTK_IS_MENU(icon->menu));
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
- /* check if menu item is connected */
- if (!GTK_IS_MENU_ITEM(icon->defaultItem))
- return;
-
- gtk_menu_shell_activate_item(GTK_MENU_SHELL(icon->menu),
- icon->defaultItem, TRUE);
+ g_signal_emit(G_OBJECT(icon), tray_signals[CLICKED], 0);
}
else if (event->button == 3) {
gtk_menu_popup(icon->menu, NULL, NULL, NULL, NULL,
@@ -109,6 +128,7 @@ xfsm_tray_icon_press(XfsmTrayIcon *icon, GdkEventButton *event, gpointer data)
/*
*/
+/* ARGSUSED */
static void
xfsm_tray_icon_popup(XfsmTrayIcon *icon, gpointer data)
{
@@ -127,7 +147,6 @@ xfsm_tray_icon_init(XfsmTrayIcon *icon)
/* no menu connected yet */
icon->menu = NULL;
- icon->defaultItem = NULL;
/* set default screen for tray icon */
netk_tray_icon_set_screen(NETK_TRAY_ICON(icon),
@@ -168,7 +187,6 @@ xfsm_tray_icon_finalize(GObject *object)
icon = XFSM_TRAY_ICON(object);
g_object_unref(G_OBJECT(icon->menu));
- g_object_unref(G_OBJECT(icon->defaultItem));
G_OBJECT_CLASS(parent_class)->finalize(object);
}
@@ -176,13 +194,12 @@ xfsm_tray_icon_finalize(GObject *object)
/*
*/
GtkWidget *
-xfsm_tray_icon_new(GtkMenu *menu, GtkWidget *defaultItem)
+xfsm_tray_icon_new(GtkMenu *menu)
{
XfsmTrayIcon *icon;
icon = XFSM_TRAY_ICON(g_object_new(xfsm_tray_icon_get_type(), NULL));
icon->menu = GTK_MENU(g_object_ref(menu));
- icon->defaultItem = GTK_WIDGET(g_object_ref(defaultItem));
return(GTK_WIDGET(icon));
}
diff --git a/xfce4-session/tray-icon.h b/xfce4-session/tray-icon.h
index f8b3f4d8..c69311fb 100644
--- a/xfce4-session/tray-icon.h
+++ b/xfce4-session/tray-icon.h
@@ -47,6 +47,9 @@ typedef struct _XfsmTrayIconClass XfsmTrayIconClass;
struct _XfsmTrayIconClass
{
NetkTrayIconClass parent_class;
+
+ /* user double-clicked the tray icon */
+ void (*clicked)(XfsmTrayIcon *);
};
struct _XfsmTrayIcon
@@ -55,14 +58,11 @@ struct _XfsmTrayIcon
/* */
GtkMenu *menu;
-
- /* */
- GtkWidget *defaultItem;
};
/* prototypes */
extern GType xfsm_tray_icon_get_type(void);
-extern GtkWidget *xfsm_tray_icon_new(GtkMenu *, GtkWidget *);
+extern GtkWidget *xfsm_tray_icon_new(GtkMenu *);
G_END_DECLS