23
23
#include <string.h>
25
25
#include <gtk/gtk.h>
26
#include <gtk/gtkhbox.h>
27
#include <gtk/gtklabel.h>
28
#include <gtk/gtkimage.h>
29
#include <gtk/gtkvbox.h>
30
#include <gtk/gtktable.h>
31
#include <gtk/gtkbutton.h>
32
#include <gtk/gtktogglebutton.h>
33
#include <gtk/gtkentry.h>
34
#include <panel-applet.h>
35
26
#include <libgnome/gnome-desktop-item.h>
36
#include <libgnomeui/libgnomeui.h>
39
#include "app-shell.h"
40
#include "app-shell-startup.h"
41
#include "slab-gnome-util.h"
27
#include <unique/unique.h>
29
#include <glib/gi18n.h>
30
#include <libslab/slab.h>
43
32
#define APPLICATION_BROWSER_PREFIX "/desktop/gnome/applications/main-menu/ab_"
44
33
#define NEW_APPS_MAX_ITEMS (APPLICATION_BROWSER_PREFIX "new_apps_max_items")
36
unique_app_message_cb (UniqueApp *app, gint command, UniqueMessageData *data,
37
guint time, gpointer user_data)
39
AppShellData *app_data = user_data;
41
if (command != UNIQUE_ACTIVATE)
42
return UNIQUE_RESPONSE_PASSTHROUGH;
44
/* move the main window to the screen that sent us the command */
45
gtk_window_set_screen (GTK_WINDOW (app_data->main_app),
46
unique_message_data_get_screen (data));
47
if (!app_data->main_app_window_shown_once)
48
show_shell (app_data);
50
gtk_window_present_with_time (GTK_WINDOW (app_data->main_app), time);
51
gtk_widget_grab_focus (SLAB_SECTION (app_data->filter_section)->contents);
53
return UNIQUE_RESPONSE_OK;
47
57
main (int argc, char *argv[])
49
BonoboApplication *bonobo_app = NULL;
59
UniqueApp *unique_app = NULL;
50
60
gboolean hidden = FALSE;
62
GOptionEntry options[] = {
63
{ "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
54
68
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
56
70
textdomain (GETTEXT_PACKAGE);
61
if (argc != 2 || strcmp ("-h", argv[1]))
63
printf ("Usage - application-browser [-h]\n");
64
printf ("Options: -h : hide on start\n");
65
printf ("\tUseful if you want to autostart the application-browser singleton so it can get all it's slow loading done\n");
74
if (!gtk_init_with_args (&argc, &argv,
75
NULL, options, GETTEXT_PACKAGE, &error)) {
76
g_printerr ("%s\n", error->message);
71
startup_id = g_strdup (g_getenv (DESKTOP_STARTUP_ID));
72
gnome_program_init ("Gnome Application Browser", "0.1", LIBGNOMEUI_MODULE,
73
argc, argv, NULL, NULL);
81
unique_app = unique_app_new ("org.gnome.MainMenu", NULL);
75
if (apss_already_running (argc, argv, &bonobo_app, "GNOME-NLD-AppBrowser", startup_id))
83
if (unique_app_is_running (unique_app))
77
gdk_notify_startup_complete ();
78
bonobo_debug_shutdown ();
85
unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL);
86
g_object_unref (unique_app);
83
91
NewAppConfig *config = g_new0 (NewAppConfig, 1);
90
98
layout_shell (app_data, _("Filter"), _("Groups"), _("Application Actions"), NULL, NULL);
92
g_signal_connect (bonobo_app, "new-instance", G_CALLBACK (apss_new_instance_cb), app_data);
93
100
create_main_window (app_data, "MyApplicationBrowser", _("Application Browser"),
94
101
"gnome-fs-client", 940, 600, hidden);
97
bonobo_object_unref (bonobo_app);
98
bonobo_debug_shutdown ();
103
unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
104
g_signal_connect (unique_app, "message-received", G_CALLBACK (unique_app_message_cb), app_data);
108
g_object_unref (unique_app);