Compare commits

...

31 Commits

Author SHA1 Message Date
Thomas Wood
b360a31d86 [shell] implement search filter feature
Allow the user to filter the list by typing a search term in the search
box.
2010-01-14 15:35:15 +00:00
Thomas Wood
d4f3cb183d [shell] set the new title on the window after the notebook has switched
Prevent the window title being set until the capplet has loaded and been
shown. This also prevents a window title being set if the capplet does not
support embedding.
2010-01-14 12:08:44 +00:00
Thomas Wood
52e62106fc [shell] add a struct to store global data 2010-01-14 12:03:09 +00:00
Thomas Wood
be122f8254 [shell] hide the All Settings button when showing all settings
The All Settings button is unnecessary when the user is already in the view
that displays the available capplets.
2010-01-14 11:10:04 +00:00
Thomas Wood
c0cbb585d7 [shell] add a mnemonic accelerator to the All Setting button 2010-01-14 11:07:49 +00:00
Thomas Wood
67619e3bd7 [shell] use the window title rather than a separate header label
Remove the header label and use the window title to display the current
capplet's name.
2010-01-14 09:45:29 +00:00
Thomas Wood
2249ec8551 [shell] fix compiler warning
Cast the callback function to the correct type to prevent a compiler
warning
2010-01-14 09:36:24 +00:00
Thomas Wood
eb90411b3a [shell] simplify the toolbar packing
Remove the unnecessary containers and don't hide the applet title label when
not in use. Keeping the title label visible ensures the alignment of the
search box is always correct.
2010-01-13 12:11:53 +00:00
Thomas Wood
e6b366f84d [shell] fix installation
Install the UI file into the correct directory and ensure the binary is
actually installed.
2010-01-13 11:51:50 +00:00
Thomas Wood
ab6c567296 [keyboard] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-12 12:08:47 +00:00
Thomas Wood
92c9f7e7ac [keyboard] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-12 12:08:41 +00:00
Thomas Wood
e94adcf7e9 [display] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-12 12:08:29 +00:00
William Jon McCann
a63ed735c6 [shell] Center title label with respect to window
Change the design from using breadcrumbs to centering the title
with respect to the top level window.  This probably makes more
sense since we expect panels to hopefully be only one level deep.
2010-01-11 13:40:54 -05:00
William Jon McCann
cc9efdf41e [shell] Add "All" to Settings button 2010-01-11 13:36:01 -05:00
William Jon McCann
4e97e65ab6 [shell] Add window title and icon
Use System Settings and preferences-system.
2010-01-11 12:01:01 -05:00
William Jon McCann
9074de36c8 [shell] Install menu and ui files 2010-01-11 11:49:05 -05:00
William Jon McCann
040ad988e3 [shell] Need to initialize lists 2010-01-11 11:48:19 -05:00
William Jon McCann
b7efebc809 [shell] Check return code to make sure UI is loaded 2010-01-11 11:47:48 -05:00
Thomas Wood
3838b65f1c [shell] switch to the capplet after a delay
If the notebook is switched to the capplet page too quickly, a black filled
rectangle appears briefly.

This should be fixed properly in the future by adjusting the capplets so
that they only plug into the socket when fully ready.
2010-01-11 16:34:15 +00:00
Thomas Wood
ba814981bc [keybinding] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-11 14:48:16 +00:00
Thomas Wood
9125c030fd [default-applications] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-11 11:19:03 +00:00
Thomas Wood
567c780dcc [about-me] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-11 11:06:21 +00:00
Thomas Wood
698c637357 [shell] add author information 2010-01-11 09:41:51 +00:00
Thomas Wood
61bb2ef2fa [shell] remove use of deprecated functions 2010-01-11 09:41:41 +00:00
Thomas Wood
f22ed32a80 [shell] ensure there is no selection when the user switches back to icons
Remove the selection from all the icon views after a capplet has been
activated so that no item is selected if the user switches back to the icon
views.
2010-01-11 09:41:19 +00:00
Thomas Wood
f119dfb98d [shell] implement single click to "activate" items
Connect to button-release-event of the icon views to enable the user to
use a single click to activate items.
2010-01-11 09:41:11 +00:00
Thomas Wood
0305603d1f [shell] increase the padding around the toolbar
Since we want the button borders to be visible all the time (unlike normal
toolbar buttons) we should add some extra spacing around them to prevent
too much visual noise against the toolbar border.
2010-01-11 09:41:03 +00:00
Thomas Wood
40e8b77253 [shell] Group the icons by category
This involves separating icon views per category and using a label as the
heading above each one.
2010-01-11 09:40:51 +00:00
Thomas Wood
be6fa081f1 Add a new experimental shell that uses GtkSocket to capture capplets 2010-01-11 09:40:34 +00:00
Thomas Wood
22945de8be [mouse] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-11 09:40:20 +00:00
Thomas Wood
b91106c128 [appearance] add a --socket option
Allow embedding in another application by adding a --socket option to
specify the ID of an window.
2010-01-11 09:38:33 +00:00
12 changed files with 849 additions and 232 deletions

View File

@@ -836,7 +836,7 @@ about_me_fingerprint_button_clicked_cb (GtkWidget *button, GnomeAboutMe *me)
}
static gint
about_me_setup_dialog (void)
about_me_setup_dialog (guint32 socket_id)
{
GtkWidget *widget;
GtkWidget *main_dialog;
@@ -861,10 +861,25 @@ about_me_setup_dialog (void)
me->dialog = dialog;
/* Connect the close button signal */
main_dialog = WID ("about-me-dialog");
g_signal_connect (main_dialog, "response",
G_CALLBACK (about_me_button_clicked_cb), me);
if (socket_id) {
GtkWidget *content, *plug;
/* re-parent contents */
content = WID ("vbox55");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit),
NULL);
gtk_widget_show_all (plug);
main_dialog = plug;
}
else {
main_dialog = WID ("about-me-dialog");
g_signal_connect (main_dialog, "response",
G_CALLBACK (about_me_button_clicked_cb), me);
}
gtk_window_set_resizable (GTK_WINDOW (main_dialog), FALSE);
capplet_set_icon (main_dialog, "user-info");
@@ -986,8 +1001,26 @@ int
main (int argc, char **argv)
{
int rc = 0;
guint32 socket_id;
capplet_init (NULL, &argc, &argv);
GOptionContext *context;
GOptionEntry cap_options[] = {
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{NULL}
};
context = g_option_context_new (_("- GNOME About Me"));
g_option_context_add_main_entries (context, cap_options,
GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
if (!g_thread_supported ())
g_thread_init (NULL);
@@ -995,7 +1028,7 @@ main (int argc, char **argv)
dbus_g_object_register_marshaller (fprintd_marshal_VOID__STRING_BOOLEAN,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
rc = about_me_setup_dialog ();
rc = about_me_setup_dialog (socket_id);
if (rc != -1) {
gtk_main ();

View File

@@ -123,6 +123,7 @@ main (int argc, char **argv)
gchar *install_filename = NULL;
gchar *start_page = NULL;
gchar **wallpaper_files = NULL;
guint socket_id = 0;
GOptionContext *option_context;
GOptionEntry option_entries[] = {
{ "install-theme",
@@ -140,6 +141,14 @@ main (int argc, char **argv)
/* TRANSLATORS: don't translate the terms in brackets */
N_("Specify the name of the page to show (theme|background|fonts|interface)"),
N_("page") },
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{ G_OPTION_REMAINING,
0,
G_OPTION_FLAG_IN_MAIN,
@@ -167,11 +176,27 @@ main (int argc, char **argv)
/* prepare the main window */
w = appearance_capplet_get_widget (data, "appearance_window");
capplet_set_icon (w, "preferences-desktop-theme");
gtk_widget_show_all (w);
if (socket_id)
{
GtkWidget *content, *plug;
g_signal_connect_after (w, "response",
(GCallback) main_window_response, data);
/* re-parent contents */
content = appearance_capplet_get_widget (data, "main_notebook");
plug = gtk_plug_new (socket_id);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_reparent (content, plug);
gtk_widget_show_all (plug);
}
else
{
capplet_set_icon (w, "preferences-desktop-theme");
gtk_widget_show_all (w);
g_signal_connect_after (w, "response",
(GCallback) main_window_response, data);
}
/* default to background page if files were given on the command line */
if (wallpaper_files && !install_filename && !start_page)

View File

@@ -700,7 +700,8 @@ _gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
static void
show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
show_dialog (GnomeDACapplet *capplet, const gchar *start_page,
guint32 socket_id)
{
GObject *obj;
GtkBuilder *builder;
@@ -729,8 +730,26 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
exit (EXIT_FAILURE);
}
capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog");
g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb), NULL);
if (socket_id) {
GtkWidget *content, *plug;
/* re-parent contents */
content = _gtk_builder_get_widget (builder, "preferred_apps_notebook");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (plug);
capplet->window = plug;
}
else {
capplet->window = _gtk_builder_get_widget (builder,
"preferred_apps_dialog");
g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb),
NULL);
}
capplet->web_browser_command_entry = _gtk_builder_get_widget (builder, "web_browser_command_entry");
capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label");
@@ -946,6 +965,7 @@ int
main (int argc, char **argv)
{
GnomeDACapplet *capplet;
guint32 socket_id;
gchar *start_page = NULL;
GOptionContext *context;
@@ -958,11 +978,22 @@ main (int argc, char **argv)
/* TRANSLATORS: don't translate the terms in brackets */
N_("Specify the name of the page to show (internet|multimedia|system|a11y)"),
N_("page") },
{ NULL }
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{NULL}
};
context = g_option_context_new (_("- GNOME Default Applications"));
g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, option_entries,
GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
@@ -976,7 +1007,7 @@ main (int argc, char **argv)
gnome_da_xml_load_list (capplet);
show_dialog (capplet, start_page);
show_dialog (capplet, start_page, socket_id);
g_free (start_page);
gtk_main ();

View File

@@ -343,7 +343,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="apply_button">
<object class="GtkButton" id="apply-button">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -358,7 +358,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<object class="GtkButton" id="close-button">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -383,8 +383,8 @@
</child>
<action-widgets>
<action-widget response="-11">helpbutton1</action-widget>
<action-widget response="-10">apply_button</action-widget>
<action-widget response="-7">button2</action-widget>
<action-widget response="-10">apply-button</action-widget>
<action-widget response="-7">close-button</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1">

View File

@@ -35,6 +35,8 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-bindings.h>
#include "capplet-util.h"
typedef struct App App;
typedef struct GrabInfo GrabInfo;
@@ -45,6 +47,7 @@ struct App
GnomeRRLabeler *labeler;
GnomeOutputInfo *current_output;
guint32 socket_id;
GtkWidget *dialog;
GtkWidget *current_monitor_event_box;
GtkWidget *current_monitor_label;
@@ -2255,6 +2258,8 @@ apply_button_clicked_cb (GtkButton *button, gpointer data)
*/
app->apply_button_clicked_timestamp = gtk_get_current_event_time ();
apply (app);
}
static GtkWidget*
@@ -2375,38 +2380,39 @@ run_application (App *app)
/* Until we have help to show, we'll just hide the Help button */
hide_help_button (app);
app->apply_button = _gtk_builder_get_widget (builder, "apply_button");
app->apply_button = _gtk_builder_get_widget (builder, "apply-button");
g_signal_connect (app->apply_button, "clicked",
G_CALLBACK (apply_button_clicked_cb), app);
g_signal_connect (_gtk_builder_get_widget (builder, "close-button"),
"clicked", G_CALLBACK (gtk_main_quit), NULL);
on_screen_changed (app->screen, app);
if (app->socket_id)
{
GtkWidget *content, *plug;
/* re-parent contents */
content = _gtk_builder_get_widget (builder, "dialog-vbox1");
plug = gtk_plug_new (app->socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (plug);
gtk_widget_hide (_gtk_builder_get_widget (builder, "close-button"));
gtk_container_set_border_width (GTK_CONTAINER (content), 12);
}
else
{
gtk_widget_show (GTK_WIDGET (app->dialog));
}
g_object_unref (builder);
restart:
switch (gtk_dialog_run (GTK_DIALOG (app->dialog)))
{
default:
/* Fall Through */
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
#if 0
g_debug ("Close");
#endif
break;
case GTK_RESPONSE_HELP:
#if 0
g_debug ("Help");
#endif
goto restart;
break;
case GTK_RESPONSE_APPLY:
apply (app);
goto restart;
break;
}
gtk_main ();
gtk_widget_destroy (app->dialog);
gnome_rr_screen_destroy (app->screen);
@@ -2417,14 +2423,31 @@ int
main (int argc, char **argv)
{
App *app;
static guint32 socket_id = 0;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
GOptionContext *context;
static GOptionEntry cap_options[] = {
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
gtk_init (&argc, &argv);
{ NULL }
};
context = g_option_context_new (_("- GNOME Display Preferences"));
g_option_context_add_main_entries (context, cap_options,
GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
app = g_new0 (App, 1);
app->socket_id = socket_id;
run_application (app);

View File

@@ -1803,7 +1803,7 @@ selection_changed (GtkTreeSelection *selection, gpointer data)
}
static void
setup_dialog (GtkBuilder *builder)
setup_dialog (GtkBuilder *builder, guint32 socket_id)
{
GConfClient *client;
GtkCellRenderer *renderer;
@@ -1868,12 +1868,39 @@ setup_dialog (GtkBuilder *builder)
/* set up the dialog */
reload_key_entries (builder);
widget = _gtk_builder_get_widget (builder, "gnome-keybinding-dialog");
capplet_set_icon (widget, "preferences-desktop-keyboard-shortcuts");
gtk_widget_show (widget);
if (socket_id)
{
GtkWidget *content, *plug;
/* re-parent contents */
content = _gtk_builder_get_widget (builder, "shortcut_dialog");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (plug);
gtk_widget_hide (_gtk_builder_get_widget (builder, "button1"));
gtk_widget_hide (_gtk_builder_get_widget (builder, "helpbutton1"));
gtk_container_set_border_width (GTK_CONTAINER (content), 12);
widget = plug;
}
else
{
widget = _gtk_builder_get_widget (builder, "gnome-keybinding-dialog");
capplet_set_icon (widget, "preferences-desktop-keyboard-shortcuts");
gtk_widget_show (widget);
g_signal_connect (widget, "key_press_event",
G_CALLBACK (maybe_block_accels), NULL);
g_signal_connect (widget, "response", G_CALLBACK (cb_dialog_response),
builder);
}
g_signal_connect (widget, "key_press_event", G_CALLBACK (maybe_block_accels), NULL);
g_signal_connect (widget, "response", G_CALLBACK (cb_dialog_response), builder);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_signal_connect (selection, "changed",
@@ -1917,15 +1944,28 @@ int
main (int argc, char *argv[])
{
GtkBuilder *builder;
guint32 socket_id;
GOptionContext *context;
GOptionEntry cap_options[] = {
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{ NULL }
};
g_thread_init (NULL);
gtk_init (&argc, &argv);
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
context = g_option_context_new (_("- GNOME Keybinding Preferences"));
g_option_context_add_main_entries (context, cap_options, GETTEXT_PACKAGE);
gtk_init (&argc, &argv);
capplet_init (context, &argc, &argv);
activate_settings_daemon ();
@@ -1935,7 +1975,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
wm_common_register_window_manager_change ((GFunc) on_window_manager_change, builder);
setup_dialog (builder);
setup_dialog (builder, socket_id);
gtk_main ();

View File

@@ -119,7 +119,8 @@ dialog_response (GtkWidget * widget,
}
static void
setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset,
guint32 socket_id)
{
GObject *peditor;
gchar *monitor;
@@ -180,8 +181,20 @@ setup_dialog (GtkBuilder * dialog, GConfChangeSet * changeset)
gtk_notebook_remove_page (nb, tb_page);
}
g_signal_connect (WID ("keyboard_dialog"), "response",
(GCallback) dialog_response, changeset);
if (socket_id) {
GtkWidget *content, *plug;
/* re-parent contents */
content = WID ("vbox1");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (plug);
} else {
g_signal_connect (WID ("keyboard_dialog"), "response",
(GCallback) dialog_response, changeset);
}
setup_xkb_tabs (dialog, changeset);
setup_a11y_tabs (dialog, changeset);
@@ -198,6 +211,7 @@ main (int argc, char **argv)
static gboolean apply_only = FALSE;
static gboolean switch_to_typing_break_page = FALSE;
static gboolean switch_to_a11y_page = FALSE;
static guint32 socket_id = 0;
static GOptionEntry cap_options[] = {
{"apply", 0, 0, G_OPTION_ARG_NONE, &apply_only,
@@ -219,6 +233,16 @@ main (int argc, char **argv)
N_
("Start the page with the accessibility settings showing"),
NULL},
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{NULL}
};
@@ -241,7 +265,7 @@ main (int argc, char **argv)
changeset = NULL;
dialog = create_dialog ();
setup_dialog (dialog, changeset);
setup_dialog (dialog, changeset, socket_id);
if (switch_to_typing_break_page) {
gtk_notebook_set_current_page (GTK_NOTEBOOK
(WID
@@ -258,7 +282,8 @@ main (int argc, char **argv)
capplet_set_icon (WID ("keyboard_dialog"),
"preferences-desktop-keyboard");
gtk_widget_show (WID ("keyboard_dialog"));
if (!socket_id)
gtk_widget_show (WID ("keyboard_dialog"));
gtk_main ();
return 0;

View File

@@ -580,6 +580,7 @@ main (int argc, char **argv)
GtkBuilder *dialog;
GtkWidget *dialog_win, *w;
gchar *start_page = NULL;
guint32 socket_id;
GOptionContext *context;
GOptionEntry cap_options[] = {
@@ -589,6 +590,14 @@ main (int argc, char **argv)
/* TRANSLATORS: don't translate the terms in brackets */
N_("Specify the name of the page to show (general|accessibility)"),
N_("page") },
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{NULL}
};
@@ -610,9 +619,24 @@ main (int argc, char **argv)
setup_dialog (dialog, NULL);
setup_accessibility (dialog, client);
dialog_win = WID ("mouse_properties_dialog");
g_signal_connect (dialog_win, "response",
G_CALLBACK (dialog_response_cb), NULL);
if (socket_id) {
GtkWidget *content, *plug;
/* re-parent contents */
content = WID ("prefs_widget");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (plug);
dialog_win = plug;
}
else {
dialog_win = WID ("mouse_properties_dialog");
g_signal_connect (dialog_win, "response",
G_CALLBACK (dialog_response_cb), NULL);
}
if (start_page != NULL) {
gchar *page_name;

View File

@@ -1367,12 +1367,28 @@ main (int argc, char **argv)
"delete_button_img", NULL};
GConfClient *client;
GtkWidget *widget;
guint32 socket_id = 0;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
GOptionContext *context;
GOptionEntry cap_options[] = {
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{ NULL }
};
context = g_option_context_new (_("- GNOME Network Preferences"));
g_option_context_add_main_entries (context, cap_options,
GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
gtk_init (&argc, &argv);
client = gconf_client_get_default ();
gconf_client_add_dir (client, "/system/http_proxy",
@@ -1392,9 +1408,32 @@ main (int argc, char **argv)
}
setup_dialog (builder);
widget = _gtk_builder_get_widget (builder, "network_dialog");
capplet_set_icon (widget, "gnome-network-properties");
gtk_widget_show_all (widget);
if (socket_id) {
GtkWidget *content, *plug;
/* re-parent contents */
content = _gtk_builder_get_widget (builder, "dialog-vbox1");
plug = gtk_plug_new (socket_id);
gtk_widget_reparent (content, plug);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit),
NULL);
gtk_widget_show_all (plug);
gtk_widget_hide (_gtk_builder_get_widget (builder,
"helpbutton1"));
gtk_widget_hide (_gtk_builder_get_widget (builder,
"closebutton1"));
gtk_container_set_border_width (GTK_CONTAINER (content), 12);
} else {
widget = _gtk_builder_get_widget (builder, "network_dialog");
capplet_set_icon (widget, "gnome-network-properties");
gtk_widget_show_all (widget);
}
gtk_main ();
g_object_unref (builder);

View File

@@ -13,6 +13,12 @@ INCLUDES = \
bin_PROGRAMS = gnome-control-center
menudir = $(sysconfdir)/xdg/menus
menu_DATA = gnomecc.menu
uidir = $(pkgdatadir)/ui
ui_DATA = shell.ui
gnome_control_center_SOURCES = \
control-center.c
@@ -21,7 +27,9 @@ gnome_control_center_LDADD = \
$(REAL_LIBSLAB_LIBS)
AM_CPPFLAGS = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\""
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DUIDIR="\"$(uidir)\"" \
-DMENUDIR="\"$(menudir)\""
sysdir = $(datadir)/applications
sys_in_files = gnomecc.desktop.in
@@ -46,10 +54,7 @@ if GCONF_SCHEMAS_INSTALL
fi
endif
menudir = $(sysconfdir)/xdg/menus
menu_DATA = gnomecc.menu
EXTRA_DIST = gnomecc.desktop.in.in gnomecc.directory.in gnomecc.menu $(schemas_DATA).in
EXTRA_DIST = $(ui_DATA) gnomecc.desktop.in.in gnomecc.directory.in gnomecc.menu $(schemas_DATA).in
DISTCLEANFILES = gnomecc.desktop gnomecc.desktop.in gnomecc.directory $(schemas_DATA)

View File

@@ -1,197 +1,427 @@
/*
* This file is part of the Control Center.
* Copyright (c) 2009, 2010 Intel, Inc.
*
* 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 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.
*
* 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
*
* 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
* Author: Thomas Wood <thos@gnome.org>
*/
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnome/gnome-desktop-item.h>
#include <unique/unique.h>
#include <gdk/gdkkeysyms.h>
#include <string.h>
#define GMENU_I_KNOW_THIS_IS_UNSTABLE
#include <gnome-menus/gmenu-tree.h>
#include <libslab/slab.h>
#define W(b,x) GTK_WIDGET (gtk_builder_get_object (b, x))
void handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data);
static GSList *get_actions_list ();
#define CONTROL_CENTER_PREFIX "/apps/control-center/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 (void)
typedef struct
{
GSList *l;
GSList *key_list;
GSList *actions_list = NULL;
AppAction *action;
GtkBuilder *builder;
GtkWidget *notebook;
GtkWidget *window;
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;
}
GSList *icon_views;
for (l = key_list; l != NULL; l = l->next)
{
gchar *entry = (gchar *) l->data;
gchar **temp;
gchar *current_title;
action = g_new (AppAction, 1);
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_prepend (actions_list, action);
}
g_strfreev (temp);
g_free (entry);
}
GtkListStore *store;
GtkTreeModel *filter;
gchar *filter_string;
g_slist_free (key_list);
} ShellData;
return g_slist_reverse (actions_list);
void item_activated_cb (GtkIconView *icon_view, GtkTreePath *path, ShellData *data);
gboolean
button_release_cb (GtkWidget *view,
GdkEventButton *event,
ShellData *data)
{
if (event->button == 1)
{
GList *selection;
selection = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (view));
if (!selection)
return FALSE;
item_activated_cb (GTK_ICON_VIEW (view), selection->data, data);
g_list_free (selection);
return TRUE;
}
return FALSE;
}
void
handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data)
selection_changed_cb (GtkIconView *view,
ShellData *data)
{
gchar *temp;
AppShellData *app_data = (AppShellData *) data;
GnomeDesktopItem *item =
(GnomeDesktopItem *) g_object_get_data (G_OBJECT (tile), APP_ACTION_KEY);
GSList *iconviews, *l;
GList *selection;
if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
return;
open_desktop_item_exec (item);
/* don't clear other selections if this icon view does not have one */
selection = gtk_icon_view_get_selected_items (view);
if (!selection)
return;
else
g_list_free (selection);
temp = g_strdup_printf("%s%s", app_data->gconf_prefix, EXIT_SHELL_ON_STATIC_ACTION);
if (get_slab_gconf_bool(temp))
{
if (app_data->exit_on_close)
gtk_main_quit ();
else
hide_shell (app_data);
}
g_free (temp);
iconviews = data->icon_views;
for (l = iconviews; l; l = l->next)
{
GtkIconView *iconview = l->data;
if (iconview != view)
{
if ((selection = gtk_icon_view_get_selected_items (iconview)))
{
gtk_icon_view_unselect_all (iconview);
g_list_free (selection);
}
}
}
}
static UniqueResponse
message_received_cb (UniqueApp *app,
UniqueCommand command,
UniqueMessageData *message,
guint time,
gpointer user_data)
gboolean
model_filter_func (GtkTreeModel *model,
GtkTreeIter *iter,
ShellData *data)
{
UniqueResponse res;
AppShellData *app_data = user_data;
gchar *name;
gchar *needle, *haystack;
switch (command) {
case UNIQUE_ACTIVATE:
/* move the main window to the screen that sent us the command */
gtk_window_set_screen (GTK_WINDOW (app_data->main_app),
unique_message_data_get_screen (message));
if (!app_data->main_app_window_shown_once)
show_shell (app_data);
gtk_tree_model_get (model, iter, 0, &name, -1);
gtk_window_present_with_time (GTK_WINDOW (app_data->main_app),
time);
if (!data->filter_string)
return FALSE;
gtk_widget_grab_focus (SLAB_SECTION (app_data->filter_section)->contents);
if (!name)
return FALSE;
res = UNIQUE_RESPONSE_OK;
break;
default:
res = UNIQUE_RESPONSE_PASSTHROUGH;
break;
}
needle = g_utf8_casefold (data->filter_string, -1);
haystack = g_utf8_casefold (name, -1);
return res;
if (strstr (haystack, needle))
return TRUE;
else
return FALSE;
}
void
fill_model (ShellData *data)
{
GSList *list, *l;
GMenuTreeDirectory *d;
GMenuTree *t;
GtkWidget *vbox, *w;
vbox = W (data->builder, "main-vbox");
t = gmenu_tree_lookup (MENUDIR "/gnomecc.menu", 0);
d = gmenu_tree_get_root_directory (t);
list = gmenu_tree_directory_get_contents (d);
data->store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING,
GDK_TYPE_PIXBUF);
data->filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (data->store),
NULL);
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (data->filter),
(GtkTreeModelFilterVisibleFunc)
model_filter_func,
data, NULL);
w = (GtkWidget *) gtk_builder_get_object (data->builder, "search-view");
gtk_icon_view_set_model (GTK_ICON_VIEW (w), GTK_TREE_MODEL (data->filter));
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (w), 2);
gtk_icon_view_set_text_column (GTK_ICON_VIEW (w), 0);
gtk_icon_view_set_item_width (GTK_ICON_VIEW (w), 120);
g_signal_connect (w, "item-activated",
G_CALLBACK (item_activated_cb), data);
g_signal_connect (w, "button-release-event",
G_CALLBACK (button_release_cb), data);
g_signal_connect (w, "selection-changed",
G_CALLBACK (selection_changed_cb), data);
for (l = list; l; l = l->next)
{
GMenuTreeItemType type;
type = gmenu_tree_item_get_type (l->data);
if (type == GMENU_TREE_ITEM_DIRECTORY)
{
GtkListStore *store;
GtkWidget *header, *iconview;
GSList *foo, *f;
const gchar *dir_name;
gchar *header_name;
foo = gmenu_tree_directory_get_contents (l->data);
dir_name = gmenu_tree_directory_get_name (l->data);
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING,
GDK_TYPE_PIXBUF);
iconview = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (iconview), 2);
gtk_icon_view_set_text_column (GTK_ICON_VIEW (iconview), 0);
gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 120);
g_signal_connect (iconview, "item-activated",
G_CALLBACK (item_activated_cb), data);
g_signal_connect (iconview, "button-release-event",
G_CALLBACK (button_release_cb), data);
g_signal_connect (iconview, "selection-changed",
G_CALLBACK (selection_changed_cb), data);
data->icon_views = g_slist_prepend (data->icon_views, iconview);
header_name = g_strdup_printf ("<b>%s</b>", dir_name);
header = g_object_new (GTK_TYPE_LABEL,
"use-markup", TRUE,
"label", header_name,
"wrap", TRUE,
"xalign", 0.0,
"xpad", 6,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, TRUE, 3);
gtk_box_pack_start (GTK_BOX (vbox), iconview, FALSE, TRUE, 0);
for (f = foo; f; f = f->next)
{
if (gmenu_tree_item_get_type (f->data)
== GMENU_TREE_ITEM_ENTRY)
{
GError *err = NULL;
const gchar *icon = gmenu_tree_entry_get_icon (f->data);
const gchar *name = gmenu_tree_entry_get_name (f->data);
const gchar *exec = gmenu_tree_entry_get_exec (f->data);
GdkPixbuf *pixbuf = NULL;
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
icon, 32,
GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
if (err)
{
g_warning ("Could not load icon: %s", err->message);
g_error_free (err);
}
gtk_list_store_insert_with_values (store, NULL, 0,
0, name,
1, exec,
2, pixbuf,
-1);
gtk_list_store_insert_with_values (data->store, NULL, 0,
0, name,
1, exec,
2, pixbuf,
-1);
}
}
}
}
}
static gboolean
switch_after_delay (ShellData *data)
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook), 2);
gtk_widget_show (W (data->builder, "home-button"));
gtk_window_set_title (GTK_WINDOW (data->window), data->current_title);
return FALSE;
}
void
plug_added_cb (GtkSocket *socket,
ShellData *data)
{
GtkWidget *notebook;
GSList *l;
notebook = W (data->builder, "notebook");
/* FIXME: this shouldn't be necassary if the capplet doesn't add to the socket
* until it is fully ready */
g_timeout_add (100, (GSourceFunc) switch_after_delay, data);
/* make sure no items are selected when the user switches back to the icon
* views */
for (l = data->icon_views; l; l = l->next)
gtk_icon_view_unselect_all (GTK_ICON_VIEW (l->data));
}
void
item_activated_cb (GtkIconView *icon_view,
GtkTreePath *path,
ShellData *data)
{
GtkTreeModel *model;
GtkTreeIter iter = {0,};
gchar *name, *exec, *command;
GtkWidget *socket, *notebook;
guint socket_id = 0;
static gint index = -1;
/* create new socket */
socket = gtk_socket_new ();
g_signal_connect (socket, "plug-added", G_CALLBACK (plug_added_cb), data);
notebook = data->notebook;
if (index >= 0)
gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), index);
index = gtk_notebook_append_page (GTK_NOTEBOOK (notebook), socket, NULL);
gtk_widget_show (socket);
socket_id = gtk_socket_get_id (GTK_SOCKET (socket));
/* get exec */
model = gtk_icon_view_get_model (icon_view);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, 0, &name, 1, &exec, -1);
g_free (data->current_title);
data->current_title = name;
/* start app */
command = g_strdup_printf ("%s --socket=%u", exec, socket_id);
g_spawn_command_line_async (command, NULL);
g_free (command);
g_free (exec);
}
void
home_button_clicked_cb (GtkButton *button,
ShellData *data)
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook), 0);
gtk_window_set_title (GTK_WINDOW (data->window), "System Settings");
gtk_widget_hide (GTK_WIDGET (button));
}
void
search_entry_changed_cb (GtkEntry *entry,
ShellData *data)
{
g_free (data->filter_string);
data->filter_string = g_strdup (gtk_entry_get_text (entry));
if (!g_strcmp0 (data->filter_string, ""))
{
home_button_clicked_cb (GTK_BUTTON (gtk_builder_get_object (data->builder,
"home-button")),
data);
}
else
{
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (data->filter));
gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook), 1);
}
}
gboolean
search_entry_key_press_event_cb (GtkEntry *entry,
GdkEventKey *event,
ShellData *data)
{
if (event->keyval == GDK_Return)
{
GtkTreePath *path;
path = gtk_tree_path_new_first ();
item_activated_cb ((GtkIconView *) gtk_builder_get_object (data->builder,
"search-view"),
path, data);
gtk_tree_path_free (path);
return TRUE;
}
if (event->keyval == GDK_Escape)
{
gtk_entry_set_text (entry, "");
return TRUE;
}
return FALSE;
}
int
main (int argc, char *argv[])
main (int argc, char **argv)
{
gboolean hidden = FALSE;
UniqueApp *unique_app;
AppShellData *app_data;
GSList *actions;
GError *error;
GOptionEntry options[] = {
{ "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
{ NULL }
};
ShellData *data;
guint ret;
GtkWidget *widget;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
gtk_init (&argc, &argv);
error = NULL;
if (!gtk_init_with_args (&argc, &argv,
NULL, options, GETTEXT_PACKAGE, &error)) {
g_printerr ("%s\n", error->message);
g_error_free (error);
return 1;
}
data = g_new0 (ShellData, 1);
unique_app = unique_app_new ("org.opensuse.yast-control-center-gnome", NULL);
if (unique_app_is_running (unique_app)) {
int retval = 0;
data->builder = gtk_builder_new ();
if (!hidden) {
UniqueResponse response;
response = unique_app_send_message (unique_app,
UNIQUE_ACTIVATE,
NULL);
retval = (response != UNIQUE_RESPONSE_OK);
}
ret = gtk_builder_add_from_file (data->builder, UIDIR "/shell.ui", NULL);
if (ret == 0)
{
g_error ("Unable to load UI");
}
g_object_unref (unique_app);
return retval;
}
data->window = W (data->builder, "main-window");
g_signal_connect (data->window, "delete-event", G_CALLBACK (gtk_main_quit),
NULL);
app_data = appshelldata_new ("gnomecc.menu", NULL, CONTROL_CENTER_PREFIX,
GTK_ICON_SIZE_DND, FALSE, TRUE);
generate_categories (app_data);
data->notebook = W (data->builder, "notebook");
actions = get_actions_list ();
layout_shell (app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions,
handle_static_action_clicked);
fill_model (data);
create_main_window (app_data, "MyControlCenter", _("Control Center"),
"gnome-control-center", 975, 600, hidden);
unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
g_signal_connect (unique_app, "message-received",
G_CALLBACK (message_received_cb), app_data);
g_signal_connect (gtk_builder_get_object (data->builder, "home-button"),
"clicked", G_CALLBACK (home_button_clicked_cb), data);
gtk_main ();
widget = (GtkWidget*) gtk_builder_get_object (data->builder, "search-entry");
g_object_unref (unique_app);
g_signal_connect (widget, "changed", G_CALLBACK (search_entry_changed_cb),
data);
g_signal_connect (widget, "key-press-event",
G_CALLBACK (search_entry_key_press_event_cb), data);
return 0;
};
gtk_widget_show_all (data->window);
gtk_main ();
g_free (data->filter_string);
g_free (data->current_title);
g_free (data);
return 0;
}

142
shell/shell.ui Normal file
View File

@@ -0,0 +1,142 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="main-window">
<property name="title" translatable="yes">System Settings</property>
<property name="default_width">1024</property>
<property name="default_height">500</property>
<property name="icon_name">preferences-system</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<child>
<object class="GtkToolItem" id="toolbutton1">
<property name="visible">True</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkButton" id="home-button">
<property name="label">_All Settings</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="xscale">0</property>
<child>
<object class="GtkEntry" id="search-entry">
<property name="width_request">210</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="primary_icon_stock">gtk-find</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="resize_mode">queue</property>
<child>
<object class="GtkVBox" id="main-vbox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkIconView" id="search-view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">liststore</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="liststore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name exec -->
<column type="gchararray"/>
<!-- column-name icon -->
<column type="gchararray"/>
</columns>
</object>
</interface>