2
* This file is part of libslab.
4
* Copyright (c) 2006 Novell, Inc.
6
* Libslab is free software; you can redistribute it and/or modify it under the
7
* terms of the GNU Lesser General Public License as published by the Free
8
* Software Foundation; either version 2 of the License, or (at your option)
11
* Libslab is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with libslab; if not, write to the Free Software Foundation, Inc., 51
18
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <libgnome/gnome-desktop-item.h>
25
#include "app-shell-startup.h"
26
#include "app-shell.h"
27
#include "search-bar.h"
28
#include "slab-section.h"
31
apss_new_instance_cb (BonoboApplication * app, gint argc, char *argv[], gpointer data)
33
AppShellData *app_data = (AppShellData *) data;
34
SlabSection *section = SLAB_SECTION (app_data->filter_section);
35
NldSearchBar *search_bar;
38
/* g_message ("new_instance_cb got called\n"); */
40
/* Make sure our implementation has not changed */
41
g_assert (NLD_IS_SEARCH_BAR (section->contents));
42
search_bar = NLD_SEARCH_BAR (section->contents);
44
g_object_get (app_data->main_gnome_app, "visible", &visible, NULL);
47
show_shell (app_data);
50
if (argc) /* if we are passed a valid startup time */
52
gchar **results = g_strsplit (argv[0], "_TIME", 0);
56
while (results[lastentry] != NULL)
58
timestamp = (guint32) g_strtod (results[lastentry - 1], NULL);
61
/* gdk_x11_window_move_to_current_desktop(window); */
62
gdk_x11_window_set_user_time (app_data->main_gnome_app->window, timestamp);
65
gtk_window_present (GTK_WINDOW (app_data->main_gnome_app));
66
gtk_widget_grab_focus (GTK_WIDGET (search_bar));
72
apss_already_running (int argc, char *argv[], BonoboApplication ** app,
73
const gchar * name, gchar * startup_id)
75
gchar const *envp[] = { "LANG", NULL };
78
BonoboAppClient *client;
79
Bonobo_RegistrationResult reg_res;
81
if (bonobo_init (&argc, argv) == FALSE)
82
g_error ("Problem with bonobo_init");
83
if (!bonobo_activate ())
84
g_error ("Problem with bonobo_activate()");
86
display_name = (char *) gdk_display_get_name (gdk_display_get_default ());
87
bonobo_activation_set_activation_env_value ("DISPLAY", display_name);
89
//make this a singleton per display per user
90
display_name = g_strconcat (name, display_name, NULL);
91
*app = bonobo_application_new (display_name);
92
g_free (display_name);
94
serverinfo = bonobo_application_create_serverinfo (*app, envp);
95
reg_res = bonobo_application_register_unique (*app, serverinfo, &client);
100
case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
105
bonobo_object_unref (BONOBO_OBJECT (*app));
108
newargv[0] = startup_id;
109
i = bonobo_app_client_new_instance (client,
110
((newargv[0] && newargv[0][0] != '\0') ? 1 : 0), newargv, NULL);
111
g_object_unref (client);
114
case Bonobo_ACTIVATION_REG_SUCCESS:
118
case Bonobo_ACTIVATION_REG_ERROR:
120
g_error ("bonobo activation error when registering unique application");