default-applications: convert capplet to a settings panel

Add a module and CcPanel implementation for default applications settings.
This commit is contained in:
Thomas Wood 2010-05-24 11:17:04 +01:00
parent f67bdb711b
commit f112fc3a8e
28 changed files with 277 additions and 59 deletions

View file

@ -2,7 +2,6 @@ SUBDIRS = \
common \ common \
accessibility \ accessibility \
appearance \ appearance \
default-applications \
display \ display \
keybindings \ keybindings \
windows windows
@ -11,7 +10,6 @@ DIST_SUBDIRS = \
common \ common \
accessibility \ accessibility \
appearance \ appearance \
default-applications \
keybindings \ keybindings \
windows \ windows \
display \ display \

View file

@ -380,11 +380,11 @@ capplets/appearance/data/Makefile
capplets/appearance/data/gnome-appearance-properties.desktop.in capplets/appearance/data/gnome-appearance-properties.desktop.in
capplets/appearance/data/gnome-theme-installer.desktop.in capplets/appearance/data/gnome-theme-installer.desktop.in
capplets/common/Makefile capplets/common/Makefile
capplets/default-applications/Makefile panels/default-applications/Makefile
capplets/default-applications/default-applications.desktop.in panels/default-applications/default-applications.desktop.in
capplets/default-applications/gnome-at-commandline.in panels/default-applications/gnome-at-commandline.in
capplets/default-applications/gnome-at-session.desktop.in panels/default-applications/gnome-at-session.desktop.in
capplets/default-applications/gnome-default-applications.pc panels/default-applications/gnome-default-applications.pc
capplets/display/Makefile capplets/display/Makefile
capplets/display/display-properties.desktop.in capplets/display/display-properties.desktop.in
capplets/keybindings/Makefile capplets/keybindings/Makefile

View file

@ -1 +1 @@
SUBDIRS=mouse keyboard network SUBDIRS=mouse keyboard network default-applications

View file

@ -1,16 +1,21 @@
# This is used in GNOMECC_CAPPLETS_CFLAGS # This is used in GNOMECC_CAPPLETS_CFLAGS
cappletname = default-applications cappletname = default-applications
bin_PROGRAMS = gnome-default-applications-properties ccpanelsdir = $(PANELS_DIR)
ccpanels_LTLIBRARIES = libdefault-applications.la
bin_SCRIPTS = gnome-at-visual gnome-at-mobility libdefault_applications_la_SOURCES = \
default-applications-module.c \
gnome_default_applications_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) cc-default-applications-panel.c cc-default-applications-panel.h \
gnome_default_applications_properties_SOURCES = \
gnome-da-capplet.c gnome-da-capplet.h \ gnome-da-capplet.c gnome-da-capplet.h \
gnome-da-xml.c gnome-da-xml.h \ gnome-da-xml.c gnome-da-xml.h \
gnome-da-item.c gnome-da-item.h gnome-da-item.c gnome-da-item.h
libdefault_applications_la_LIBADD = $(PANEL_LIBS)
libdefault_applications_la_LDFLAGS = $(PANEL_LDFLAGS)
bin_SCRIPTS = gnome-at-visual gnome-at-mobility
@INTLTOOL_DESKTOP_RULE@ @INTLTOOL_DESKTOP_RULE@
uidir = $(pkgdatadir)/ui uidir = $(pkgdatadir)/ui
@ -42,7 +47,7 @@ INCLUDES = \
$(GNOMECC_CAPPLETS_CFLAGS) \ $(GNOMECC_CAPPLETS_CFLAGS) \
$(DEFAULT_APPLICATIONS_CAPPLET_CFLAGS) \ $(DEFAULT_APPLICATIONS_CAPPLET_CFLAGS) \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\ -DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
-DGNOMECC_UI_DIR=\""$(uidir)"\" \ -DGNOMECC_UI_DIR=\""$(uidir)"\" \
-DGNOMECC_APPS_DIR=\""$(xmldatadir)"\" -DGNOMECC_APPS_DIR=\""$(xmldatadir)"\"
icons16dir = $(datadir)/icons/hicolor/16x16/apps icons16dir = $(datadir)/icons/hicolor/16x16/apps

View file

@ -0,0 +1,132 @@
/*
* Copyright (C) 2010 Intel, Inc
*
* 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 of the License, 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.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include "cc-default-applications-panel.h"
#include "gnome-da-capplet.h"
G_DEFINE_DYNAMIC_TYPE (CcDefaultApplicationsPanel, cc_default_applications_panel, CC_TYPE_PANEL)
#define DEFAULT_APPLICATIONS_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_DEFAULT_APPLICATIONS_PANEL, CcDefaultApplicationsPanelPrivate))
struct _CcDefaultApplicationsPanelPrivate
{
GnomeDACapplet *capplet;
};
static void
cc_default_applications_panel_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
cc_default_applications_panel_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
cc_default_applications_panel_dispose (GObject *object)
{
CcDefaultApplicationsPanelPrivate *priv;
priv = CC_DEFAULT_APPLICATIONS_PANEL (object)->priv;
if (priv->capplet)
{
g_object_unref (priv->capplet->gconf);
gnome_da_xml_free (priv->capplet);
priv->capplet = NULL;
}
G_OBJECT_CLASS (cc_default_applications_panel_parent_class)->dispose (object);
}
static void
cc_default_applications_panel_finalize (GObject *object)
{
G_OBJECT_CLASS (cc_default_applications_panel_parent_class)->finalize (object);
}
static void
cc_default_applications_panel_class_init (CcDefaultApplicationsPanelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (CcDefaultApplicationsPanelPrivate));
object_class->get_property = cc_default_applications_panel_get_property;
object_class->set_property = cc_default_applications_panel_set_property;
object_class->dispose = cc_default_applications_panel_dispose;
object_class->finalize = cc_default_applications_panel_finalize;
}
static void
cc_default_applications_panel_class_finalize (CcDefaultApplicationsPanelClass *klass)
{
}
static void
cc_default_applications_panel_init (CcDefaultApplicationsPanel *self)
{
CcDefaultApplicationsPanelPrivate *priv;
GtkWidget *widget;
priv = self->priv = DEFAULT_APPLICATIONS_PANEL_PRIVATE (self);
priv->capplet = g_new0 (GnomeDACapplet, 1);
priv->capplet->gconf = gconf_client_get_default ();
gnome_default_applications_panel_init (priv->capplet);
widget = (GtkWidget *) gtk_builder_get_object (priv->capplet->builder,
"preferred_apps_notebook");
gtk_widget_reparent (widget, (GtkWidget *) self);
}
void
cc_default_applications_panel_register (GIOModule *module)
{
cc_default_applications_panel_register_type (G_TYPE_MODULE (module));
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
CC_TYPE_DEFAULT_APPLICATIONS_PANEL,
"default-applications.desktop", 0);
}

View file

@ -0,0 +1,74 @@
/*
* Copyright (C) 2010 Intel, Inc
*
* 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 of the License, 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.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#ifndef _CC_DEFAULT_APPLICATIONS_PANEL_H
#define _CC_DEFAULT_APPLICATIONS_PANEL_H
#include <libgnome-control-center/cc-panel.h>
G_BEGIN_DECLS
#define CC_TYPE_DEFAULT_APPLICATIONS_PANEL cc_default_applications_panel_get_type()
#define CC_DEFAULT_APPLICATIONS_PANEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CC_TYPE_DEFAULT_APPLICATIONS_PANEL, CcDefaultApplicationsPanel))
#define CC_DEFAULT_APPLICATIONS_PANEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CC_TYPE_DEFAULT_APPLICATIONS_PANEL, CcDefaultApplicationsPanelClass))
#define CC_IS_DEFAULT_APPLICATIONS_PANEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CC_TYPE_DEFAULT_APPLICATIONS_PANEL))
#define CC_IS_DEFAULT_APPLICATIONS_PANEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CC_TYPE_DEFAULT_APPLICATIONS_PANEL))
#define CC_DEFAULT_APPLICATIONS_PANEL_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CC_TYPE_DEFAULT_APPLICATIONS_PANEL, CcDefaultApplicationsPanelClass))
typedef struct _CcDefaultApplicationsPanel CcDefaultApplicationsPanel;
typedef struct _CcDefaultApplicationsPanelClass CcDefaultApplicationsPanelClass;
typedef struct _CcDefaultApplicationsPanelPrivate CcDefaultApplicationsPanelPrivate;
struct _CcDefaultApplicationsPanel
{
CcPanel parent;
CcDefaultApplicationsPanelPrivate *priv;
};
struct _CcDefaultApplicationsPanelClass
{
CcPanelClass parent_class;
};
GType cc_default_applications_panel_get_type (void) G_GNUC_CONST;
void cc_default_applications_panel_register (GIOModule *module);
G_END_DECLS
#endif /* _CC_DEFAULT_APPLICATIONS_PANEL_H */

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

View file

@ -0,0 +1,41 @@
/*
* Copyright (C) 2010 Intel, Inc
*
* 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 of the License, 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.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include <config.h>
#include "cc-default-applications-panel.h"
#include <glib/gi18n.h>
void
g_io_module_load (GIOModule *module)
{
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
/* register the panel */
cc_default_applications_panel_register (module);
}
void
g_io_module_unload (GIOModule *module)
{
}

View file

@ -40,6 +40,7 @@ enum
N_COLUMNS N_COLUMNS
}; };
/*
static void static void
close_cb (GtkWidget *window, gint response, gpointer user_data) close_cb (GtkWidget *window, gint response, gpointer user_data)
{ {
@ -51,6 +52,7 @@ close_cb (GtkWidget *window, gint response, gpointer user_data)
gtk_main_quit (); gtk_main_quit ();
} }
} }
*/
static void static void
set_icon (GtkImage *image, GtkIconTheme *theme, const char *name) set_icon (GtkImage *image, GtkIconTheme *theme, const char *name)
@ -730,7 +732,6 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
} }
capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog"); 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_entry = _gtk_builder_get_widget (builder, "web_browser_command_entry");
capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label"); capplet->web_browser_command_label = _gtk_builder_get_widget (builder, "web_browser_command_label");
@ -938,36 +939,11 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
} }
g_free (page_name); g_free (page_name);
} }
gtk_widget_show (capplet->window);
} }
int void
main (int argc, char **argv) gnome_default_applications_panel_init (GnomeDACapplet *capplet)
{ {
GnomeDACapplet *capplet;
gchar *start_page = NULL;
GOptionContext *context;
GOptionEntry option_entries[] = {
{ "show-page",
'p',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_STRING,
&start_page,
/* TRANSLATORS: don't translate the terms in brackets */
N_("Specify the name of the page to show (internet|multimedia|system|a11y)"),
N_("page") },
{ NULL }
};
context = g_option_context_new (_("- GNOME Default Applications"));
g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);
capplet_init (context, &argc, &argv);
capplet = g_new0 (GnomeDACapplet, 1);
capplet->gconf = gconf_client_get_default ();
gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers", gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers",
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
gconf_client_add_dir (capplet->gconf, gconf_client_add_dir (capplet->gconf,
@ -976,14 +952,5 @@ main (int argc, char **argv)
gnome_da_xml_load_list (capplet); gnome_da_xml_load_list (capplet);
show_dialog (capplet, start_page); show_dialog (capplet, 0);
g_free (start_page);
gtk_main ();
g_object_unref (capplet->gconf);
gnome_da_xml_free (capplet);
return 0;
} }

View file

@ -123,4 +123,5 @@ struct _GnomeDACapplet {
GList *mobility_ats; GList *mobility_ats;
}; };
void gnome_default_applications_panel_init (GnomeDACapplet *capplet);
#endif #endif

View file

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

Before After
Before After

View file

@ -36,11 +36,11 @@ capplets/common/file-transfer-dialog.c
capplets/common/gconf-property-editor.c capplets/common/gconf-property-editor.c
libgnome-control-center/gconf-property-editor.c libgnome-control-center/gconf-property-editor.c
capplets/common/gnome-theme-info.c capplets/common/gnome-theme-info.c
capplets/default-applications/default-applications.desktop.in.in panels/default-applications/default-applications.desktop.in.in
capplets/default-applications/gnome-at-session.desktop.in.in panels/default-applications/gnome-at-session.desktop.in.in
capplets/default-applications/gnome-da-capplet.c panels/default-applications/gnome-da-capplet.c
[type: gettext/glade]capplets/default-applications/gnome-default-applications-properties.ui [type: gettext/glade]panels/default-applications/gnome-default-applications-properties.ui
capplets/default-applications/gnome-default-applications.xml.in panels/default-applications/gnome-default-applications.xml.in
[type: gettext/glade]capplets/display/display-capplet.ui [type: gettext/glade]capplets/display/display-capplet.ui
capplets/display/display-properties.desktop.in.in capplets/display/display-properties.desktop.in.in
capplets/display/gnome-display-properties-install-systemwide.c capplets/display/gnome-display-properties-install-systemwide.c

View file

@ -4,8 +4,8 @@ capplets/accessibility/keyboard/accessibility-keyboard.desktop.in
capplets/appearance/data/gnome-appearance-properties.desktop.in capplets/appearance/data/gnome-appearance-properties.desktop.in
capplets/appearance/data/gnome-theme-installer.desktop.in capplets/appearance/data/gnome-theme-installer.desktop.in
capplets/appearance/data/gnome-theme-package.xml capplets/appearance/data/gnome-theme-package.xml
capplets/default-applications/default-applications.desktop.in panels/default-applications/default-applications.desktop.in
capplets/default-applications/gnome-at-session.desktop.in panels/default-applications/gnome-at-session.desktop.in
capplets/display/display-properties.desktop.in capplets/display/display-properties.desktop.in
capplets/keybindings/keybinding.desktop.in capplets/keybindings/keybinding.desktop.in
panels/keyboard/keyboard.desktop.in panels/keyboard/keyboard.desktop.in