new control center shell.
2006-11-13 Rodrigo Moya <rodrigo@novell.com> * shell/*: new control center shell. * Makefile.am: * configure.in: added new directory to build.
This commit is contained in:
parent
8745b61e1b
commit
adb4a3a024
6 changed files with 192 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-11-13 Rodrigo Moya <rodrigo@novell.com>
|
||||
|
||||
* shell/*: new control center shell.
|
||||
|
||||
* Makefile.am:
|
||||
* configure.in: added new directory to build.
|
||||
|
||||
2006-10-18 Sergey Udaltsov <svu@gnome.org>
|
||||
|
||||
* Makefile.am, configure.in, capplets/keyboard/Makefile.am,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = po libsounds libbackground libwindow-settings gnome-settings-daemon capplets control-center help vfs-methods idl schemas $(TYPING_BREAK)
|
||||
SUBDIRS = po libsounds libbackground libwindow-settings libslab gnome-settings-daemon capplets shell help vfs-methods idl schemas $(TYPING_BREAK)
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
|
|
@ -96,8 +96,9 @@ COMMON_MODULES="gtk+-2.0 >= 2.3.0 dnl
|
|||
libbonobo-2.0 dnl
|
||||
libbonoboui-2.0 dnl
|
||||
gnome-desktop-2.0 >= 2.2.0"
|
||||
PKG_CHECK_MODULES(LIBSLAB, $COMMON_MODULES gnome-desktop-2.0 librsvg-2.0 libgnome-menu pango)
|
||||
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
|
||||
PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1)
|
||||
PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1 libpanelapplet-2.0)
|
||||
PKG_CHECK_MODULES(GNOME_SETTINGS_DAEMON,
|
||||
[gtk+-2.0 gconf-2.0 libgnomeui-2.0 esound gnome-desktop-2.0 libglade-2.0])
|
||||
PKG_CHECK_MODULES(OLD_CAPPLET, libgnomeui-2.0 libglade-2.0)
|
||||
|
@ -594,11 +595,12 @@ AC_CONFIG_FILES([
|
|||
Makefile
|
||||
po/Makefile.in
|
||||
idl/Makefile
|
||||
libslab/Makefile
|
||||
gnome-settings-daemon/Makefile
|
||||
gnome-settings-daemon/xrdb/Makefile
|
||||
gnome-settings-daemon/actions/Makefile
|
||||
gnome-settings-daemon/gnome-settings-daemon.pc
|
||||
control-center/Makefile
|
||||
shell/Makefile
|
||||
libbackground/Makefile
|
||||
libwindow-settings/Makefile
|
||||
libwindow-settings/gnome-window-settings-2.0.pc
|
||||
|
|
7
shell/.cvsignore
Normal file
7
shell/.cvsignore
Normal file
|
@ -0,0 +1,7 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
*.o
|
||||
.deps
|
||||
.libs
|
||||
.thumbnails
|
||||
gnome-control-center
|
15
shell/Makefile.am
Normal file
15
shell/Makefile.am
Normal file
|
@ -0,0 +1,15 @@
|
|||
INCLUDES = \
|
||||
-I$(top_srcdir)/libslab \
|
||||
$(GNOMECC_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = gnome-control-center
|
||||
|
||||
gnome_control_center_SOURCES = \
|
||||
control-center.c
|
||||
|
||||
gnome_control_center_LDADD = \
|
||||
$(GNOMECC_LIBS) \
|
||||
$(top_builddir)/libslab/libslab.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
|
158
shell/control-center.c
Normal file
158
shell/control-center.c
Normal file
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* This file is part of the Control Center.
|
||||
*
|
||||
* Copyright (c) 2006 Novell, Inc.
|
||||
*
|
||||
* The Control Center 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.
|
||||
*
|
||||
* The Control Center 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 General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* the Control Center; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkhbox.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtkimage.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gtk/gtkbutton.h>
|
||||
#include <gtk/gtktogglebutton.h>
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <panel-applet.h>
|
||||
#include <libgnome/gnome-desktop-item.h>
|
||||
#include <libgnomeui/libgnomeui.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "app-shell.h"
|
||||
#include "app-shell-startup.h"
|
||||
#include "slab-gnome-util.h"
|
||||
|
||||
void handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data);
|
||||
static GSList *get_actions_list ();
|
||||
|
||||
#define CONTROL_CENTER_PREFIX "/desktop/gnome/applications/main-menu/cc_"
|
||||
#define CONTROL_CENTER_ACTIONS_LIST_KEY (CONTROL_CENTER_PREFIX "actions_list")
|
||||
#define CONTROL_CENTER_ACTIONS_SEPARATOR ";"
|
||||
#define EXIT_SHELL_ON_STATIC_ACTION "exit_shell_on_static_action"
|
||||
|
||||
static GSList *
|
||||
get_actions_list ()
|
||||
{
|
||||
GSList *key_list;
|
||||
GSList *actions_list = NULL;
|
||||
AppAction *action;
|
||||
|
||||
key_list = get_slab_gconf_slist (CONTROL_CENTER_ACTIONS_LIST_KEY);
|
||||
if (!key_list)
|
||||
{
|
||||
g_warning (_("key not found [%s]\n"), CONTROL_CENTER_ACTIONS_LIST_KEY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (; key_list; key_list = key_list->next)
|
||||
{
|
||||
gchar *entry = (gchar *) key_list->data;
|
||||
|
||||
action = g_new (AppAction, 1);
|
||||
gchar **temp = g_strsplit (entry, CONTROL_CENTER_ACTIONS_SEPARATOR, 2);
|
||||
action->name = g_strdup (temp[0]);
|
||||
if ((action->item = load_desktop_item_from_unknown (temp[1])) == NULL)
|
||||
{
|
||||
g_warning ("get_actions_list() - PROBLEM - Can't load %s\n", temp[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
actions_list = g_slist_append (actions_list, action);
|
||||
}
|
||||
g_strfreev (temp);
|
||||
g_free (entry);
|
||||
}
|
||||
|
||||
g_slist_free (key_list);
|
||||
return actions_list;
|
||||
}
|
||||
|
||||
void
|
||||
handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data)
|
||||
{
|
||||
gchar *temp;
|
||||
|
||||
AppShellData *app_data = (AppShellData *) data;
|
||||
GnomeDesktopItem *item =
|
||||
(GnomeDesktopItem *) g_object_get_data (G_OBJECT (tile), APP_ACTION_KEY);
|
||||
open_desktop_item_exec (item);
|
||||
|
||||
temp = g_strdup_printf("%s%s", app_data->gconf_prefix, EXIT_SHELL_ON_STATIC_ACTION);
|
||||
if (get_slab_gconf_bool(temp))
|
||||
gtk_main_quit ();
|
||||
g_free (temp);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
BonoboApplication *bonobo_app = NULL;
|
||||
gboolean hidden = FALSE;
|
||||
gchar * startup_id;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (argc != 2 || strcmp ("-h", argv[1]))
|
||||
{
|
||||
printf ("Usage - control-center [-h]\n");
|
||||
printf ("Options: -h : hide on start\n");
|
||||
printf ("\tUseful if you want to autostart the control-center singleton so it can get all it's slow loading done\n");
|
||||
exit (1);
|
||||
}
|
||||
hidden = TRUE;
|
||||
}
|
||||
|
||||
startup_id = g_strdup (g_getenv (DESKTOP_STARTUP_ID));
|
||||
gnome_program_init ("Gnome Control Center", "0.1", LIBGNOMEUI_MODULE,
|
||||
argc, argv, NULL, NULL);
|
||||
|
||||
if (apss_already_running (argc, argv, &bonobo_app, "GNOME-NLD-ControlCenter", startup_id))
|
||||
{
|
||||
gdk_notify_startup_complete ();
|
||||
bonobo_debug_shutdown ();
|
||||
g_free (startup_id);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
AppShellData *app_data = appshelldata_new (
|
||||
"preferences.menu", NULL, CONTROL_CENTER_PREFIX, GTK_ICON_SIZE_DIALOG);
|
||||
generate_categories (app_data);
|
||||
|
||||
GSList *actions = get_actions_list ();
|
||||
layout_shell (app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions,
|
||||
handle_static_action_clicked);
|
||||
|
||||
g_signal_connect (bonobo_app, "new-instance", G_CALLBACK (apss_new_instance_cb), app_data);
|
||||
create_main_window (app_data, "MyControlCenter", _("Control Center"),
|
||||
"gnome-control-center", 975, 600, hidden);
|
||||
|
||||
if (bonobo_app)
|
||||
bonobo_object_unref (bonobo_app);
|
||||
bonobo_debug_shutdown ();
|
||||
g_free (startup_id);
|
||||
return 0;
|
||||
};
|
Loading…
Add table
Reference in a new issue