diff options
author | Bradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org> | 2000-08-01 20:22:57 +0000 |
---|---|---|
committer | Bradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org> | 2000-08-01 20:22:57 +0000 |
commit | 5eeb2d20a6f9c8ae9194fd124e6e78bb5f1a076a (patch) | |
tree | 2152f0dacc7ea9a6aee88d05f533aba84916a8e2 | |
parent | f743b8507405de4f90fa8d38c87bc6c18aab9985 (diff) | |
download | gnome-control-center-5eeb2d20a6f9c8ae9194fd124e6e78bb5f1a076a.tar.gz |
New control center implementation
-rw-r--r-- | control-center/Makefile.am | 36 | ||||
-rw-r--r-- | control-center/capplet-dir-window.c | 201 | ||||
-rw-r--r-- | control-center/capplet-dir-window.h | 46 | ||||
-rw-r--r-- | control-center/capplet-dir.c | 292 | ||||
-rw-r--r-- | control-center/capplet-dir.h | 74 | ||||
-rw-r--r-- | control-center/ccsplash.png | bin | 0 -> 25562 bytes | |||
-rw-r--r-- | control-center/control-center.png | bin | 0 -> 3296 bytes | |||
-rw-r--r-- | control-center/gnomecc.desktop | 56 | ||||
-rw-r--r-- | control-center/main.c | 52 | ||||
-rw-r--r-- | control-center/root-manager.c | 77 |
10 files changed, 834 insertions, 0 deletions
diff --git a/control-center/Makefile.am b/control-center/Makefile.am new file mode 100644 index 000000000..8a163186a --- /dev/null +++ b/control-center/Makefile.am @@ -0,0 +1,36 @@ +appicondir = $(datadir)/pixmaps +appicon_DATA = control-center.png + +splashdir = $(datadir)/pixmaps +splash_DATA = ccsplash.png + +sysdir = $(datadir)/gnome/apps/Settings +sys_DATA = gnomecc.desktop + +INCLUDES = \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ + -I$(top_srcdir)/intl -I$(top_builddir)/intl \ + -I$(includedir) $(GNOME_INCLUDEDIR) \ + -DVERSION=\""$(VERSION)"\" \ + -DSETTINGS_DIR=\""$(sysdir)"\" \ + -DPIXMAPS_DIR=\""$(appicondir)"\" + +bin_PROGRAMS = gnomecc root-manager + +gnomecc_SOURCES = \ + main.c \ + capplet-dir.c capplet-dir.h \ + capplet-dir-window.c capplet-dir-window.h + +gnomecc_LDADD = \ + $(GNOME_LIBDIR) \ + $(GNOMEUI_LIBS) \ + $(INTLLIBS) + +root_manager_SOURCES = \ + root-manager.c + +root_manager_LDADD = \ + $(GNOME_LIBS) + +EXTRA_DIST = gnomecc.desktop $(appicon_DATA) $(splash_DATA) diff --git a/control-center/capplet-dir-window.c b/control-center/capplet-dir-window.c new file mode 100644 index 000000000..6da4bce76 --- /dev/null +++ b/control-center/capplet-dir-window.c @@ -0,0 +1,201 @@ +/* -*- mode: c; style: linux -*- */ + +/* capplet-dir-window.c + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "capplet-dir-window.h" + +static void close_cb (GtkWidget *widget, CappletDirWindow *window); +static void help_cb (GtkWidget *widget, CappletDirWindow *window); +static void about_cb (GtkWidget *widget, CappletDirWindow *window); + +static void select_cb (GtkWidget *widget, + gint arg1, + GdkEvent *event, + CappletDirWindow *window); + +static void about_done_cb (GtkWidget *widget, gpointer user_data); + +static guint window_count; + +static GtkWidget *about; + +static GnomeUIInfo file_menu[] = { + GNOMEUIINFO_MENU_CLOSE_ITEM (close_cb, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo help_menu[] = { + + GNOMEUIINFO_ITEM_STOCK (N_("Help on control-center"), + N_("Help with the GNOME control-center."), + help_cb, GNOME_STOCK_PIXMAP_HELP), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_STOCK (N_("About"), + N_("About the GNOME control-center."), + about_cb, GNOME_STOCK_MENU_ABOUT), + GNOMEUIINFO_END +}; + +static GnomeUIInfo menu_bar[] = { + GNOMEUIINFO_MENU_FILE_TREE (file_menu), + GNOMEUIINFO_MENU_HELP_TREE (help_menu), + GNOMEUIINFO_END +}; + +CappletDirWindow *capplet_dir_window_new (CappletDir *dir) +{ + CappletDirWindow *window; + GtkWidget *swin; + GtkAdjustment *adjustment; + int i; + + swin = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + adjustment = gtk_scrolled_window_get_vadjustment + (GTK_SCROLLED_WINDOW (swin)); + + window = g_new0 (CappletDirWindow, 1); + window->capplet_dir = dir; + window->app = + GNOME_APP (gnome_app_new ("control-center", + CAPPLET_DIR_ENTRY (dir)->label)); + window->icon_list = + GNOME_ICON_LIST (gnome_icon_list_new (96, adjustment, 0)); + + gtk_container_add (GTK_CONTAINER (swin), + GTK_WIDGET (window->icon_list)); + + gnome_icon_list_freeze (window->icon_list); + + for (i = 0; dir->entries[i]; i++) + gnome_icon_list_insert (window->icon_list, i, + dir->entries[i]->icon, + dir->entries[i]->label); + + gnome_icon_list_thaw (window->icon_list); + + gtk_widget_set_usize (GTK_WIDGET (window->app), 400, 300); + + gtk_signal_connect (GTK_OBJECT (window->app), "destroy", + GTK_SIGNAL_FUNC (close_cb), window); + gtk_signal_connect (GTK_OBJECT (window->icon_list), "select-icon", + GTK_SIGNAL_FUNC (select_cb), window); + + gnome_app_create_menus_with_data (window->app, menu_bar, window); + gnome_app_set_contents (window->app, swin); + gtk_widget_show_all (GTK_WIDGET (window->app)); + + window_count++; + + return window; +} + +void capplet_dir_window_destroy (CappletDirWindow *window) +{ + if (!window->destroyed) { + window->destroyed = TRUE; + + if (!GTK_OBJECT_DESTROYED (GTK_OBJECT (window->app))) + gtk_object_destroy (GTK_OBJECT (window->app)); + g_free (window); + + window_count--; + + if (window_count == 0) gtk_main_quit (); + } +} + +static void +close_cb (GtkWidget *widget, CappletDirWindow *window) +{ + capplet_dir_window_destroy (window); +} + +static void +help_cb (GtkWidget *widget, CappletDirWindow *window) +{ + gchar *tmp; + + tmp = gnome_help_file_find_file ("users-guide", "gcc.html"); + + if (tmp) { + gnome_help_goto (0, tmp); + g_free (tmp); + } else { + GtkWidget *mbox; + + mbox = gnome_message_box_new + (_("No help is available/installed. Please " \ + "make sure you\nhave the GNOME User's " \ + "Guide installed on your system."), + GNOME_MESSAGE_BOX_ERROR, _("Close"), NULL); + + gtk_widget_show (mbox); + } +} + +static void +about_cb (GtkWidget *widget, CappletDirWindow *window) +{ + static gchar *authors[] = { + "Bradford Hovinen <hovinen@helixcode.com>", + NULL + }; + + if (about == NULL) { + about = gnome_about_new + (_("GNOME Control Center"), VERSION, + "Copyright (C) 2000 Helix Code, Inc.\n", + (const gchar **) authors, + _("Desktop Properties manager."), + NULL); + + gtk_signal_connect (GTK_OBJECT (about), "destroy", + about_done_cb, NULL); + } + + gtk_widget_show (about); +} + +static void +select_cb (GtkWidget *widget, gint arg1, GdkEvent *event, + CappletDirWindow *window) +{ + if (event->type == GDK_2BUTTON_PRESS && + ((GdkEventButton *) event)->button == 1) + { + capplet_dir_entry_activate + (window->capplet_dir->entries[arg1]); + } +} + +static void +about_done_cb (GtkWidget *widget, gpointer user_data) +{ + gtk_widget_hide (about); +} diff --git a/control-center/capplet-dir-window.h b/control-center/capplet-dir-window.h new file mode 100644 index 000000000..7340aca56 --- /dev/null +++ b/control-center/capplet-dir-window.h @@ -0,0 +1,46 @@ +/* -*- mode: c; style: linux -*- */ + +/* capplet-dir-window.h + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef __CAPPLET_DIR_WINDOW +#define __CAPPLET_DIR_WINDOW + +#include <gnome.h> + +#include "capplet-dir.h" + +#define CAPPLET_DIR_WINDOW(obj) ((CappletDirWindow *) obj) + +struct _CappletDirWindow +{ + CappletDir *capplet_dir; + + GnomeApp *app; + GnomeIconList *icon_list; + + gboolean destroyed; +}; + +CappletDirWindow *capplet_dir_window_new (CappletDir *dir); +void capplet_dir_window_destroy (CappletDirWindow *window); + +#endif /* __CAPPLET_DIR_WINDOW */ diff --git a/control-center/capplet-dir.c b/control-center/capplet-dir.c new file mode 100644 index 000000000..f623a12c8 --- /dev/null +++ b/control-center/capplet-dir.c @@ -0,0 +1,292 @@ +/* -*- mode: c; style: linux -*- */ + +/* capplet-dir.c + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#include <errno.h> + +#include "capplet-dir.h" +#include "capplet-dir-window.h" + +static void capplet_activate (Capplet *capplet); +static void capplet_dir_activate (CappletDir *capplet_dir); + +static void capplet_shutdown (Capplet *capplet); +static void capplet_dir_shutdown (CappletDir *capplet_dir); + +static CappletDirEntry **read_entries (gchar *path); + +static void start_capplet_through_root_manager (GnomeDesktopEntry *gde); + +CappletDirEntry * +capplet_new (gchar *desktop_path) +{ + Capplet *capplet; + CappletDirEntry *entry; + + g_return_val_if_fail (desktop_path != NULL, NULL); + + capplet = g_new0 (Capplet, 1); + entry = CAPPLET_DIR_ENTRY (capplet); + + entry->type = TYPE_CAPPLET; + entry->entry = gnome_desktop_entry_load (desktop_path); + entry->label = entry->entry->name; + entry->icon = entry->entry->icon; + + /* Don't continue if this is just the control center again */ + if (!strcmp (entry->entry->exec[0], "gnomecc")) { + capplet_dir_entry_destroy (entry); + return NULL; + } + + if (!entry->icon) + entry->icon = PIXMAPS_DIR "/control-center.png"; + + return entry; +} + +CappletDirEntry * +capplet_dir_new (gchar *dir_path) +{ + CappletDir *capplet_dir; + CappletDirEntry *entry; + gchar *desktop_path; + + g_return_val_if_fail (dir_path != NULL, NULL); + + desktop_path = g_concat_dir_and_file (dir_path, ".directory"); + + capplet_dir = g_new0 (CappletDir, 1); + entry = CAPPLET_DIR_ENTRY (capplet_dir); + + entry->type = TYPE_CAPPLET_DIR; + entry->entry = gnome_desktop_entry_load (desktop_path); + + g_free (desktop_path); + + if (entry->entry) { + entry->label = entry->entry->name; + entry->icon = entry->entry->icon; + + if (!entry->icon) + entry->icon = PIXMAPS_DIR "/control-center.png"; + } else { + /* If the .directory file could not be found or read, abort */ + g_free (capplet_dir); + return NULL; + } + + capplet_dir->path = g_strdup (dir_path); + + return entry; +} + +void +capplet_dir_entry_destroy (CappletDirEntry *entry) +{ + if (entry->type == TYPE_CAPPLET) { + capplet_shutdown (CAPPLET (entry)); + } else { + capplet_dir_shutdown (CAPPLET_DIR (entry)); + g_free (CAPPLET_DIR (entry)->path); + } + + gnome_desktop_entry_free (entry->entry); + g_free (entry); +} + +void +capplet_dir_entry_activate (CappletDirEntry *entry) +{ + g_return_if_fail (entry != NULL); + + if (entry->type == TYPE_CAPPLET) + capplet_activate (CAPPLET (entry)); + else if (entry->type == TYPE_CAPPLET_DIR) + capplet_dir_activate (CAPPLET_DIR (entry)); + else + g_assert_not_reached (); +} + +void +capplet_dir_entry_shutdown (CappletDirEntry *entry) +{ + if (entry->type == TYPE_CAPPLET) + capplet_shutdown (CAPPLET (entry)); + else if (entry->type == TYPE_CAPPLET_DIR) + capplet_dir_shutdown (CAPPLET_DIR (entry)); + else + g_assert_not_reached (); +} + +static void +capplet_activate (Capplet *capplet) +{ + GnomeDesktopEntry *entry; + + entry = CAPPLET_DIR_ENTRY (capplet)->entry; + + if (!strcmp (entry->exec[0], "root-manager")) + start_capplet_through_root_manager (entry); + else + gnome_desktop_entry_launch (entry); +} + +static void +capplet_dir_activate (CappletDir *capplet_dir) +{ + capplet_dir->entries = read_entries (capplet_dir->path); + capplet_dir->window = capplet_dir_window_new (capplet_dir); +} + +static void +capplet_shutdown (Capplet *capplet) +{ + /* Can't do much here ... :-( */ +} + +static void +capplet_dir_shutdown (CappletDir *capplet_dir) +{ + int i; + + if (capplet_dir->window) + capplet_dir_window_destroy (capplet_dir->window); + + if (capplet_dir->entries) { + for (i = 0; capplet_dir->entries[i]; i++) + capplet_dir_entry_destroy + (capplet_dir->entries[i]); + g_free (capplet_dir->entries); + } +} + +static CappletDirEntry ** +read_entries (gchar *path) +{ + DIR *parent_dir; + struct dirent *child_dir; + struct stat filedata; + GList *list_head, *list_tail; + CappletDirEntry *entry; + gchar *fullpath; + CappletDirEntry **entry_array; + int i; + + parent_dir = opendir (path); + if (parent_dir == NULL) + return NULL; + + list_head = list_tail = NULL; + + while ((child_dir = readdir (parent_dir)) != NULL) { + if (child_dir->d_name[0] != '.') { + /* we check to see if it is interesting. */ + fullpath = g_concat_dir_and_file (path, + child_dir->d_name); + + if (stat (fullpath, &filedata) != -1) { + gchar* test; + + entry = NULL; + + if (S_ISDIR (filedata.st_mode)) { + entry = capplet_dir_new (fullpath); + } else { + test = rindex(child_dir->d_name, '.'); + + if (test && + !strcmp (".desktop", test)) + /* it's a .desktop file -- + * it's interesting for sure! */ + entry = capplet_new (fullpath); + } + + if (entry) { + list_tail = g_list_append + (list_tail, entry); + if (!list_head) + list_head = list_tail; + else + list_tail = list_tail->next; + } + } + + g_free (fullpath); + } + } + + closedir (parent_dir); + + /* Allocate the array and copy the list contents over */ + entry_array = g_new0 (CappletDirEntry *, + g_list_length (list_head) + 1); + + i = 0; + while (list_head) { + entry_array[i++] = list_head->data; + list_head = g_list_remove_link (list_head, list_head); + } + + entry_array[i] = NULL; + + return entry_array; +} + +static void +start_capplet_through_root_manager (GnomeDesktopEntry *gde) +{ + static FILE *output = NULL; + pid_t pid; + char *cmdline; + + if (!output) { + gint pipe_fd[2]; + pipe (pipe_fd); + + pid = fork (); + + if (pid == (pid_t) -1) { + g_error ("%s", g_strerror (errno)); + } + else if (pid == 0) { + char *arg[2]; + + dup2 (pipe_fd[0], 0); + + arg[0] = gnome_is_program_in_path ("root-manager"); + arg[1] = NULL; + execv (arg[0], arg); + } + } + + cmdline = g_strjoinv (" ", gde->exec + 1); + fprintf (output, "%s\n", cmdline); + g_free (cmdline); +} diff --git a/control-center/capplet-dir.h b/control-center/capplet-dir.h new file mode 100644 index 000000000..62f3b016d --- /dev/null +++ b/control-center/capplet-dir.h @@ -0,0 +1,74 @@ +/* -*- mode: c; style: linux -*- */ + +/* capplet-dir.h + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef __CAPPLET_DIR_H +#define __CAPPLET_DIR_H + +#include <gnome.h> + +#define CAPPLET_DIR_ENTRY(obj) ((CappletDirEntry *) obj) +#define CAPPLET_DIR(obj) ((CappletDir *) obj) +#define CAPPLET(obj) ((Capplet *) obj) + +typedef struct _CappletDirEntry CappletDirEntry; +typedef struct _CappletDir CappletDir; +typedef struct _Capplet Capplet; + +typedef struct _CappletDirWindow CappletDirWindow; + +typedef enum { + TYPE_CAPPLET, TYPE_CAPPLET_DIR +} CappletEntryType; + +struct _CappletDirEntry +{ + CappletEntryType type; + GnomeDesktopEntry *entry; + gchar *label; + gchar *icon; +}; + +struct _CappletDir +{ + CappletDirEntry entry; + gchar *path; + CappletDirEntry **entries; + CappletDirWindow *window; +}; + +struct _Capplet +{ + CappletDirEntry entry; +}; + +CappletDirEntry *capplet_new (gchar *desktop_path); +CappletDirEntry *capplet_dir_new (gchar *dir_path); + +void capplet_dir_entry_destroy (CappletDirEntry *entry); + +void capplet_dir_entry_activate (CappletDirEntry *entry); +void capplet_dir_entry_shutdown (CappletDirEntry *entry); + +void control_center_init (int *argc, char **argv); + +#endif /* __CAPPLET_DIR_H */ diff --git a/control-center/ccsplash.png b/control-center/ccsplash.png Binary files differnew file mode 100644 index 000000000..10a122f39 --- /dev/null +++ b/control-center/ccsplash.png diff --git a/control-center/control-center.png b/control-center/control-center.png Binary files differnew file mode 100644 index 000000000..eb6d12fe7 --- /dev/null +++ b/control-center/control-center.png diff --git a/control-center/gnomecc.desktop b/control-center/gnomecc.desktop new file mode 100644 index 000000000..b8e0a0cc5 --- /dev/null +++ b/control-center/gnomecc.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Name=GNOME Control Center +Name[ca]=Centre de Control GNOME +Name[cs]=Øídící centrum Gnome +Name[da]=Kontrolcenter +Name[de]=GNOME-Kontrollzentrum +Name[en_GB]Gnome Control Centre +Name[es]=Centro de Control GNOME +Name[et]=Juhtpaneel +Name[fi]=GNOME-hallintakeskus +Name[fr]=Centre de contrôle GNOME +Name[gl]=Centro de Control de GNOME +Name[hu]=GNOME Vezérlõpult +Name[ja]=GNOME¥³¥ó¥È¥í¡¼¥ë¥»¥ó¥¿¡¼ +Name[ko]=±×³ð Á¶Á¾ÆÇ +Name[lt]=GNOME Valdymo centras +Name[no]=GNOME kontrollsenter +Name[pl]=Centrum Sterowania GNOME +Name[pt]=Centro de Controlo GNOME +Name[pt_BR]=Centro de Controle GNOME +Name[ru]=ãÅÎÔÒ õÐÒÁ×ÌÅÎÉÑ GNOME +Name[sv]=GNOME Kontrollcenter +Name[tr]=Gnome Ayarlar Merkezi +Name[uk]=ãÅÎÔÒ ËÅÒÕ×ÁÎÎÑ GNOME +Name[wa]=Cente di contrôle di GNOME +Name[zh_TW.Big5]=GNOME ±±¨î¥x +Name[zh_CN.GB2312]=GNOME ¿ØÖÆ̨ +Comment=The GNOME configuration tool. +Comment[ca]=La ferramenta de configuració de GNOME +Comment[cs]=Øídící centrum Gnome - úprava vzhledu, nastavení periférií atd. +Comment[da]=Gnomes konfigurationsværktøj +Comment[de]=Das Konfigurationswerkzeug für GNOME +Comment[es]=Herramienta de configuración del entorno GNOME +Comment[et]=GNOME kasutajaliidese häälestusprogramm +Comment[fi]=GNOME:n hallintatyökalu +Comment[fr]=Outil de configuration de GNOME. +Comment[gl]=A ferramenta de configuración de GNOME +Comment[hu]=GNOME konfiguráció +Comment[ja]=GNOME¤ÎÀßÄê¥Ä¡¼¥ë¤Ç¤¹ +Comment[ko]=±×³ð ¼³Á¤ ÇÁ·Î±×·¥ +Comment[lt]=GNOME aplinkos konfigûravimo árankis. +Comment[no]=Konfigurasjonsverktøy for GNOME +Comment[pl]=Narzêdzie do konfiguracji GNOME +Comment[pt]=A ferramenta de configuração GNOME. +Comment[pt_BR]=A ferramenta de configuração GNOME +Comment[ru]=óÒÅÄÓÔ×Ï ËÏÎÆÉÇÕÒÁÃÉÉ GNOME +Comment[sv]=Konfigurationsverktyg för GNOME +Comment[tr]=Gnome'un ayarlar merkezi +Comment[uk]=úÁӦ ËÏÎƦÇÕÒÕ×ÁÎÎÑ GNOME +Comment[wa]=L' usteye d' apontiaedje di GNOME +Comment[zh_TW.Big5]=¦UºØ GNOME ³]©w¤u¨ã +Comment[zh_CN.GB2312]=¸÷ÖÖ GNOME É趨¹¤¾ß +Icon=control-center.png +Exec=gnomecc +Terminal=0 +Type=Application diff --git a/control-center/main.c b/control-center/main.c new file mode 100644 index 000000000..7cc16e750 --- /dev/null +++ b/control-center/main.c @@ -0,0 +1,52 @@ +/* -*- mode: c; style: linux -*- */ + +/* main.c + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gnome.h> + +#include "capplet-dir.h" + +int +main (int argc, char **argv) +{ + CappletDirEntry *main_dir; + + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE); + + gnome_init ("control-center", VERSION, argc, argv); + + main_dir = capplet_dir_new (SETTINGS_DIR); + + if (!main_dir) + g_error ("Could not find directory of control panels"); + + capplet_dir_entry_activate (main_dir); + + gtk_main (); + + return 0; +} diff --git a/control-center/root-manager.c b/control-center/root-manager.c new file mode 100644 index 000000000..0b2c22ed5 --- /dev/null +++ b/control-center/root-manager.c @@ -0,0 +1,77 @@ +/* -*- mode: c; style: linux -*- */ + +/* root-manager.c + * Copyright (C) 2000 Helix Code, Inc. + * + * Written by Bradford Hovinen (hovinen@helixcode.com) + * + * This program 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, or (at your option) + * any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <errno.h> +#include <unistd.h> +#include <sys/types.h> +#include <glib.h> + +#include <libgnome/libgnome.h> + +int +main (int argc, char **argv) +{ + char *buffer, *tmp; + char **args; + gint buf_size = 1024; + pid_t pid; + + if (argc > 1) { + execv (gnome_is_program_in_path (args[1]), argv + 1); + g_error ("%s", g_strerror (errno)); + } + + buffer = g_new (char, buf_size); + + while (1) { + tmp = buffer; + fgets (tmp, 1023, stdin); + + while (strlen (tmp) == 1023) { + buf_size *= 2; + buffer = g_renew (char, buffer, buf_size); + tmp += 1023; + fgets (tmp, 1023, stdin); + } + + pid = fork (); + + if (pid == (pid_t) -1) { + g_error ("%s", g_strerror (errno)); + } + else if (pid == 0) { + buffer[strlen (buffer) - 1] = '\0'; + args = g_strsplit (buffer, " ", -1); + printf ("Output: %s", args[0]); + execv (gnome_is_program_in_path (args[0]), args); + g_error ("%s", g_strerror (errno)); + } + } + + return 0; +} |