Commit 0934e079 authored by Scott Reeves's avatar Scott Reeves

launcher for panel dialog

svn path=/trunk/; revision=533
parent 981ae6af
2008-12-29 Scott Reeves <sreeves@novell.com>
* main-menu/src/trigger-panel-run-dialog.c
* main-menu/src/Makefile.am
* main-menu/etc/trigger-panel-run-dialog.desktop
* main-menu/etc/Makefile.am:
Add a trivial launcher of the panel "Run Application" dialog for
optional inclusion in the system area
2008-12-29 Scott Reeves <sreeves@novell.com>
* main-menu/src/network-status-agent.c:
Patch from Tambet to match the NetworkManager API change
......
......@@ -10,7 +10,7 @@ uidir = $(datadir)/gnome-2.0/ui
ui_DATA = GNOME_MainMenu_ContextMenu.xml
desktopdir = $(datadir)/applications
desktop_DATA = gnome-screensaver-lock.desktop gnome-session-kill.desktop
desktop_DATA = gnome-screensaver-lock.desktop gnome-session-kill.desktop trigger-panel-run-dialog.desktop
@INTLTOOL_DESKTOP_RULE@
bookmarkdir = $(datadir)/gnome-main-menu
......
[Desktop Entry]
Name=Run Application
Comment=Show the "Run Application" panel app
Exec=trigger-panel-run-dialog
Terminal=false
Type=Application
Icon=system-run
Hidden=true
Categories=System;SystemSetup;
OnlyShowIn=GNOME;
StartupNotify=true
......@@ -8,6 +8,8 @@ glade_DATA = slab-window.glade
libexec_PROGRAMS = main-menu
bin_PROGRAMS = trigger-panel-run-dialog
AM_CPPFLAGS = \
$(GLADE_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
......@@ -30,4 +32,10 @@ main_menu_LDADD = \
$(GLADE_LIBS) \
$(top_builddir)/libslab/libslab.la
trigger_panel_run_dialog_SOURCES = \
trigger-panel-run-dialog.c
trigger_panel_run_dialog_LDADD = \
$(MAIN_MENU_LIBS)
EXTRA_DIST = $(glade_DATA)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
static void
run_dialog (GdkDisplay *display, GdkScreen *screen, guint32 timestamp)
{
Atom action_atom;
Atom atom;
Window root;
XClientMessageEvent ev;
if (!display)
display = gdk_display_get_default ();
if (!screen)
screen = gdk_display_get_default_screen (display);
root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
action_atom = gdk_x11_get_xatom_by_name_for_display (display, "_GNOME_PANEL_ACTION");
atom = gdk_x11_get_xatom_by_name_for_display (display, "_GNOME_PANEL_ACTION_RUN_DIALOG");
ev.type = ClientMessage;
ev.window = root;
ev.message_type = action_atom;
ev.format = 32;
ev.data.l[0] = atom;
ev.data.l[1] = timestamp;
gdk_error_trap_push ();
XSendEvent (gdk_x11_display_get_xdisplay (display),
root, False, StructureNotifyMask, (XEvent*) &ev);
gdk_flush ();
gdk_error_trap_pop ();
}
int
main (int argc, char **argv)
{
gint lastentry = 0;
guint32 timestamp;
const gchar* startup_id = g_getenv ("DESKTOP_STARTUP_ID");
//printf ("startup id is %s\n", startup_id);
if (startup_id && (startup_id[0] != '\0'))
{
gchar **results = g_strsplit (startup_id, "_TIME", 0);
while (results[lastentry] != NULL)
lastentry++;
timestamp = (guint32) g_strtod (results[lastentry - 1], NULL);
g_strfreev (results);
}
else
timestamp = GDK_CURRENT_TIME;
gdk_init (&argc, &argv);
run_dialog (NULL, NULL, timestamp);
gdk_notify_startup_complete ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment