Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Meego:Netbook:1.2
gnome-control-center-netbook
0004-Add-Language-settings-panel.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-Add-Language-settings-panel.patch of Package gnome-control-center-netbook
From 68009ea6a172137951c147ce94752b4e13a16316 Mon Sep 17 00:00:00 2001 From: Thomas Wood <thomas.wood@intel.com> Date: Thu, 26 Aug 2010 14:54:07 +0100 Subject: [PATCH 04/13] Add Language settings panel --- capplets/Makefile.am | 2 + capplets/language/Makefile.am | 30 +++++++ capplets/language/cc-language-panel.c | 143 +++++++++++++++++++++++++++++++++ capplets/language/cc-language-panel.h | 54 ++++++++++++ capplets/language/lib.c | 34 ++++++++ configure.ac | 1 + 6 files changed, 264 insertions(+), 0 deletions(-) create mode 100644 capplets/language/Makefile.am create mode 100644 capplets/language/cc-language-panel.c create mode 100644 capplets/language/cc-language-panel.h create mode 100644 capplets/language/lib.c diff --git a/capplets/Makefile.am b/capplets/Makefile.am index a599573..65d80c3 100644 --- a/capplets/Makefile.am +++ b/capplets/Makefile.am @@ -10,6 +10,7 @@ SUBDIRS = \ network \ windows \ date + language DIST_SUBDIRS = \ common \ @@ -23,6 +24,7 @@ DIST_SUBDIRS = \ windows \ display \ date \ + language \ about-me diff --git a/capplets/language/Makefile.am b/capplets/language/Makefile.am new file mode 100644 index 0000000..f07a29a --- /dev/null +++ b/capplets/language/Makefile.am @@ -0,0 +1,30 @@ +INCLUDES = \ + $(GNOMECC_CAPPLETS_CFLAGS) \ + -I$(top_srcdir)/libgnome-control-center-extension \ + -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ + -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ + -DGNOMECC_UI_DIR="\"$(uidir)\"" + +AM_CPPFLAGS = \ + -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ + -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ + -DPACKAGE_DATA_DIR=\""$(datadir)"\" $(PANEL_CFLAGS) + +AM_CFLAGS = $(EXTENSION_CFLAGS) $(EXTENSION_COMMON_CFLAGS) + +libdir = $(EXTENSIONSDIR) +lib_LTLIBRARIES = liblanguage.la + + +liblanguage_la_SOURCES = \ + lib.c \ + cc-language-panel.h \ + cc-language-panel.c + +liblanguage_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS) + +liblanguage_la_LIBADD = $(EXTENSION_LIBS) $(EXTENSION_COMMON_LIBS) + + + +-include $(top_srcdir)/git.mk diff --git a/capplets/language/cc-language-panel.c b/capplets/language/cc-language-panel.c new file mode 100644 index 0000000..109ca22 --- /dev/null +++ b/capplets/language/cc-language-panel.c @@ -0,0 +1,143 @@ +/* + * language-panels + * Copyright (C) 2010 Intel Corporation + * + * language-panels 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 3 of the License, or + * (at your option) any later version. + * + * language-panels 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, see <http://www.gnu.org/licenses/>. + */ + +#include "cc-language-panel.h" + +G_DEFINE_DYNAMIC_TYPE (CcLanguagePanel, cc_language_panel, CC_TYPE_PANEL); + +static void +map (GtkWidget *socket) +{ + gchar *command; + GError *err = NULL; + static GdkNativeWindow win = 0; + GdkNativeWindow new_win; + + g_debug ("map"); + + new_win = gtk_socket_get_id (GTK_SOCKET (socket)); + + /* map is called multiple times */ + if (new_win == win) + return; + win = new_win; + + command = g_strdup_printf ("system-config-language --socket %d", win); + + + g_debug ("Running %s", command); + g_spawn_command_line_async (command, &err); + + if (err) + { + g_warning ("Error loading system-config-language: %s", err->message); + g_error_free (err); + } +} + +static gboolean +plug_removed (GtkSocket *socket, + CcPanel *panel) +{ + CcShell *shell; + + shell = cc_panel_get_shell (panel); + + cc_shell_set_panel (shell, NULL); + + return FALSE; +} + +static void +active_changed_cb (CcLanguagePanel *panel, + gboolean is_active, + gpointer *data) +{ + if (is_active) + { + panel->socket = gtk_socket_new (); + gtk_container_add (GTK_CONTAINER (panel), panel->socket); + + g_signal_connect (panel->socket, "map", G_CALLBACK (map), NULL); + g_signal_connect (panel->socket, "plug-removed", + G_CALLBACK (plug_removed), panel); + gtk_widget_show (panel->socket); + } + else + { + gtk_widget_destroy (panel->socket); + panel->socket = NULL; + } + +} + +static void +cc_language_panel_init (CcLanguagePanel *object) +{ + g_signal_connect (object, "active-changed", G_CALLBACK (active_changed_cb), + NULL); + object->socket = NULL; +} + +static void +cc_language_panel_finalize (GObject *object) +{ + G_OBJECT_CLASS (cc_language_panel_parent_class)->finalize (object); +} + +static GObject* +cc_language_panel_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + CcLanguagePanel *language_panel; + + language_panel = CC_LANGUAGE_PANEL (G_OBJECT_CLASS (cc_language_panel_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + g_object_set (language_panel, + "display-name", ("Language"), + "id","system-config-language.desktop", + NULL); + + return G_OBJECT (language_panel); +} + +static void +cc_language_panel_class_init (CcLanguagePanelClass *klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = cc_language_panel_finalize; + object_class->constructor = cc_language_panel_constructor; +} + +static void +cc_language_panel_class_finalize (CcLanguagePanelClass *klass) +{ +} + +void +cc_language_panel_register (GIOModule *module) +{ + cc_language_panel_register_type (G_TYPE_MODULE (module)); + g_io_extension_point_implement (CC_PANEL_EXTENSION_POINT_NAME, + CC_TYPE_LANGUAGE_PANEL, + "language", + 10); +} diff --git a/capplets/language/cc-language-panel.h b/capplets/language/cc-language-panel.h new file mode 100644 index 0000000..994c87d --- /dev/null +++ b/capplets/language/cc-language-panel.h @@ -0,0 +1,54 @@ +/* + * language-panels + * Copyright (C) 2010 Intel Corporation + * + * language-panels 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 3 of the License, or + * (at your option) any later version. + * + * language-panels 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _CC_LANGUAGE_PANEL_H_ +#define _CC_LANGUAGE_PANEL_H_ + +#include <glib-object.h> +#include "cc-panel.h" + +G_BEGIN_DECLS + +#define CC_TYPE_LANGUAGE_PANEL (cc_language_panel_get_type ()) +#define CC_LANGUAGE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_LANGUAGE_PANEL, CcLanguagePanel)) +#define CC_LANGUAGE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_LANGUAGE_PANEL, CcLanguagePanelClass)) +#define CC_IS_LANGUAGE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_LANGUAGE_PANEL)) +#define CC_IS_LANGUAGE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_LANGUAGE_PANEL)) +#define CC_LANGUAGE_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_LANGUAGE_PANEL, CcLanguagePanelClass)) + +typedef struct _CcLanguagePanelClass CcLanguagePanelClass; +typedef struct _CcLanguagePanel CcLanguagePanel; + +struct _CcLanguagePanelClass +{ + CcPanelClass parent_class; +}; + +struct _CcLanguagePanel +{ + CcPanel parent_instance; + + GtkWidget *socket; +}; + +GType cc_language_panel_get_type (void) G_GNUC_CONST; +void cc_language_panel_register (GIOModule *module); + +G_END_DECLS + +#endif /* _CC_LANGUAGE_PANEL_H_ */ diff --git a/capplets/language/lib.c b/capplets/language/lib.c new file mode 100644 index 0000000..f46c39a --- /dev/null +++ b/capplets/language/lib.c @@ -0,0 +1,34 @@ +/* + * lib.c + * Copyright (C) 2010 Intel Corporation + * + * language-panels 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 3 of the License, or + * (at your option) any later version. + * + * language-panels 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, see <http://www.gnu.org/licenses/>. + */ + +#include <config.h> +#include <stdio.h> +#include <gio/gio.h> + +#include "cc-language-panel.h" + +void +g_io_module_load (GIOModule *module) +{ + cc_language_panel_register (module); +} + +void +g_io_module_unload (GIOModule *module) +{ +} diff --git a/configure.ac b/configure.ac index 60ffe47..1278b56 100644 --- a/configure.ac +++ b/configure.ac @@ -373,6 +373,7 @@ capplets/network/gnome-network-properties.desktop.in capplets/windows/Makefile capplets/windows/window-properties.desktop.in capplets/date/Makefile +capplets/language/Makefile font-viewer/Makefile font-viewer/gnome-font-viewer.desktop.in help/Makefile -- 1.7.2.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor