default-applications: convert capplet to a settings panel
Add a module and CcPanel implementation for default applications settings.
80
panels/default-applications/Makefile.am
Normal file
|
@ -0,0 +1,80 @@
|
|||
# This is used in GNOMECC_CAPPLETS_CFLAGS
|
||||
cappletname = default-applications
|
||||
|
||||
ccpanelsdir = $(PANELS_DIR)
|
||||
ccpanels_LTLIBRARIES = libdefault-applications.la
|
||||
|
||||
libdefault_applications_la_SOURCES = \
|
||||
default-applications-module.c \
|
||||
cc-default-applications-panel.c cc-default-applications-panel.h \
|
||||
gnome-da-capplet.c gnome-da-capplet.h \
|
||||
gnome-da-xml.c gnome-da-xml.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@
|
||||
|
||||
uidir = $(pkgdatadir)/ui
|
||||
dist_ui_DATA = gnome-default-applications-properties.ui
|
||||
|
||||
gnome-at-visual: gnome-at-commandline.in
|
||||
cp $< $@
|
||||
|
||||
gnome-at-mobility: gnome-at-commandline.in
|
||||
cp $< $@
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
Desktop_in_files = default-applications.desktop.in
|
||||
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
pkgconfigdir = $(datadir)/pkgconfig
|
||||
pkgconfig_DATA = gnome-default-applications.pc
|
||||
|
||||
autostartdir = $(sysconfdir)/xdg/autostart
|
||||
autostart_in_files = gnome-at-session.desktop.in
|
||||
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
|
||||
|
||||
xmldata_in_files = gnome-default-applications.xml.in
|
||||
xmldatadir = $(pkgdatadir)/default-apps
|
||||
xmldata_DATA = $(xmldata_in_files:.xml.in=.xml)
|
||||
@INTLTOOL_XML_RULE@
|
||||
|
||||
INCLUDES = \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
$(DEFAULT_APPLICATIONS_CAPPLET_CFLAGS) \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
|
||||
-DGNOMECC_UI_DIR=\""$(uidir)"\" \
|
||||
-DGNOMECC_APPS_DIR=\""$(xmldatadir)"\"
|
||||
|
||||
icons16dir = $(datadir)/icons/hicolor/16x16/apps
|
||||
dist_icons16_DATA = icons/16x16/gnome-settings-default-applications.png
|
||||
icons22dir = $(datadir)/icons/hicolor/22x22/apps
|
||||
dist_icons22_DATA = icons/22x22/gnome-settings-default-applications.png
|
||||
icons24dir = $(datadir)/icons/hicolor/24x24/apps
|
||||
dist_icons24_DATA = icons/24x24/gnome-settings-default-applications.png
|
||||
icons32dir = $(datadir)/icons/hicolor/32x32/apps
|
||||
dist_icons32_DATA = icons/32x32/gnome-settings-default-applications.png
|
||||
icons48dir = $(datadir)/icons/hicolor/48x48/apps
|
||||
dist_icons48_DATA = icons/48x48/gnome-settings-default-applications.png
|
||||
|
||||
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
|
||||
uninstall-hook: update-icon-cache
|
||||
install-data-hook: update-icon-cache
|
||||
update-icon-cache:
|
||||
@-if test -z "$(DESTDIR)"; then \
|
||||
echo "Updating Gtk icon cache."; \
|
||||
$(gtk_update_icon_cache); \
|
||||
else \
|
||||
echo "*** Icon cache not updated. After install, run this:"; \
|
||||
echo "*** $(gtk_update_icon_cache)"; \
|
||||
fi
|
||||
|
||||
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) $(xmldata_DATA) $(autostart_DATA) $(bin_SCRIPTS)
|
||||
EXTRA_DIST = $(xmldata_in_files) gnome-default-applications.pc.in
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
132
panels/default-applications/cc-default-applications-panel.c
Normal 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);
|
||||
}
|
||||
|
74
panels/default-applications/cc-default-applications-panel.h
Normal 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 */
|
BIN
panels/default-applications/default-applications-capplet.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
41
panels/default-applications/default-applications-module.c
Normal 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)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
[Desktop Entry]
|
||||
_Name=Preferred Applications
|
||||
_Comment=Select your default applications
|
||||
Exec=gnome-default-applications-properties
|
||||
Icon=gnome-settings-default-applications
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;GTK;Settings;X-GNOME-PersonalSettings;
|
||||
OnlyShowIn=GNOME;
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=gnome-control-center
|
||||
X-GNOME-Bugzilla-Component=Preferred applications
|
||||
X-GNOME-Bugzilla-Version=@VERSION@
|
101
panels/default-applications/gnome-at-commandline.in.in
Normal file
|
@ -0,0 +1,101 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2006 IBM Corp.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation
|
||||
#
|
||||
# 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
###############################################################################
|
||||
#
|
||||
# NOTE: This script is intended to be run from the command line,
|
||||
# GNOME menu, or from the desktop autostart.
|
||||
#
|
||||
# /usr/bin/gnome-at-visual
|
||||
# /usr/bin/gnome-at-mobility
|
||||
#
|
||||
# If the "-s" flag is used then it is assumed to have been invoked
|
||||
# from /usr/share/gnome/autostart/, and the first AT flagged
|
||||
# to "startup" from GCONF_ALL will be executed.
|
||||
#
|
||||
|
||||
USAGE="$0 [-s]"
|
||||
GCONF_PATH=/desktop/gnome/applications/at
|
||||
GCONF_VISUAL="visual"
|
||||
GCONF_MOBILITY="mobility"
|
||||
GCONF_ALL="$GCONF_VISUAL $GCONF_MOBILITY"
|
||||
|
||||
run_at() {
|
||||
CMDLINE=`gconftool-2 --get $GCONF_PATH/$1/exec`
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ -z "$CMDLINE" ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
STARTUP=`gconftool-2 --get $GCONF_PATH/$1/startup`
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ ! -z "$AUTOSTART" ]; then
|
||||
# assuming ran from /usr/share/gnome/autostart
|
||||
if [ "x$STARTUP" = "xtrue" ]; then
|
||||
# gconf indicated requested autostart
|
||||
($CMDLINE &)
|
||||
fi
|
||||
else
|
||||
# run from command line or desktop menu
|
||||
($CMDLINE &)
|
||||
fi
|
||||
}
|
||||
|
||||
case `basename $0` in
|
||||
gnome-at-visual )
|
||||
AT=$GCONF_VISUAL
|
||||
;;
|
||||
gnome-at-mobility )
|
||||
AT=$GCONF_MOBILITY
|
||||
;;
|
||||
gnome-at-session | * )
|
||||
AUTOSTART="yes"
|
||||
AT=$GCONF_ALL
|
||||
;;
|
||||
esac
|
||||
|
||||
while getopts "s" options; do
|
||||
case $options in
|
||||
s ) AUTOSTART="yes"
|
||||
AT=$GCONF_ALL
|
||||
shift
|
||||
;;
|
||||
\? ) echo $USAGE
|
||||
exit 1
|
||||
;;
|
||||
* ) echo $USAGE
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
echo $USAGE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for I in $AT ; do
|
||||
run_at $I
|
||||
done
|
||||
|
||||
#EOF
|
15
panels/default-applications/gnome-at-session.desktop.in.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Desktop Entry]
|
||||
_Name=Visual Assistance
|
||||
_Comment=Start the preferred visual assistive technology
|
||||
Exec=gnome-at-visual -s
|
||||
Icon=preferences-desktop-accessibility
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
OnlyShowIn=GNOME;
|
||||
AutostartCondition=GNOME /desktop/gnome/interface/accessibility
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=gnome-control-center
|
||||
X-GNOME-Bugzilla-Component=other capplets
|
||||
X-GNOME-Bugzilla-Version=@VERSION@
|
||||
X-GNOME-Autostart-enabled=true
|
956
panels/default-applications/gnome-da-capplet.c
Normal file
|
@ -0,0 +1,956 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
* Copyright 2008 Thomas Wood <thos@gnome.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gconf-property-editor.h"
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-xml.h"
|
||||
#include "gnome-da-item.h"
|
||||
#include "capplet-util.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PIXBUF_COL,
|
||||
TEXT_COL,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
/*
|
||||
static void
|
||||
close_cb (GtkWidget *window, gint response, gpointer user_data)
|
||||
{
|
||||
if (response == GTK_RESPONSE_HELP) {
|
||||
capplet_help (GTK_WINDOW (window), "prefs-preferredapps");
|
||||
}
|
||||
else {
|
||||
gtk_widget_destroy (window);
|
||||
gtk_main_quit ();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
set_icon (GtkImage *image, GtkIconTheme *theme, const char *name)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if ((pixbuf = gtk_icon_theme_load_icon (theme, name, 48, 0, NULL))) {
|
||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
web_radiobutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet)
|
||||
{
|
||||
gint index;
|
||||
GnomeDAWebItem *item;
|
||||
const gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
index = gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box));
|
||||
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
item = (GnomeDAWebItem *) g_list_nth_data (capplet->web_browsers, index);
|
||||
if (item == NULL)
|
||||
return;
|
||||
|
||||
if (togglebutton == capplet->new_win_radiobutton) {
|
||||
command = item->win_command;
|
||||
}
|
||||
else if (togglebutton == capplet->new_tab_radiobutton) {
|
||||
command = item->tab_command;
|
||||
}
|
||||
else {
|
||||
command = item->generic.command;
|
||||
}
|
||||
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, command, &error);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
web_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
gboolean has_net_remote;
|
||||
GnomeDAWebItem *item;
|
||||
GtkWidget *active = NULL;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
|
||||
if (current_index < g_list_length (capplet->web_browsers)) {
|
||||
|
||||
item = (GnomeDAWebItem*) g_list_nth_data (capplet->web_browsers, current_index);
|
||||
has_net_remote = item->netscape_remote;
|
||||
is_custom_active = FALSE;
|
||||
|
||||
}
|
||||
else {
|
||||
has_net_remote = FALSE;
|
||||
is_custom_active = TRUE;
|
||||
}
|
||||
gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
|
||||
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
|
||||
|
||||
if (has_net_remote) {
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)))
|
||||
active = capplet->new_win_radiobutton;
|
||||
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)))
|
||||
active = capplet->new_tab_radiobutton;
|
||||
else
|
||||
active = capplet->default_radiobutton;
|
||||
}
|
||||
|
||||
web_radiobutton_toggled_cb (active, capplet);
|
||||
}
|
||||
|
||||
/* FIXME: Refactor these two functions below into one... */
|
||||
static void
|
||||
mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
is_custom_active = (current_index >= g_list_length (capplet->mail_readers));
|
||||
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_terminal_checkbutton, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
media_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
is_custom_active = (current_index >= g_list_length (capplet->media_players));
|
||||
|
||||
gtk_widget_set_sensitive (capplet->media_player_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->media_player_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->media_player_terminal_checkbutton, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
terminal_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
is_custom_active = (current_index >= g_list_length (capplet->terminals));
|
||||
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_label, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
visual_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
is_custom_active = (current_index >= g_list_length (capplet->visual_ats));
|
||||
|
||||
gtk_widget_set_sensitive (capplet->visual_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->visual_command_label, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
mobility_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
current_index = gtk_combo_box_get_active (combo);
|
||||
is_custom_active = (current_index >= g_list_length (capplet->mobility_ats));
|
||||
|
||||
gtk_widget_set_sensitive (capplet->mobility_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
refresh_combo_box_icons (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
|
||||
{
|
||||
GList *entry;
|
||||
GnomeDAItem *item;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
for (entry = app_list; entry != NULL; entry = g_list_next (entry)) {
|
||||
item = (GnomeDAItem *) entry->data;
|
||||
|
||||
model = gtk_combo_box_get_model (combo_box);
|
||||
|
||||
if (item->icon_path && gtk_tree_model_get_iter_from_string (model, &iter, item->icon_path)) {
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
PIXBUF_COL, pixbuf,
|
||||
-1);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
const gchar *name;
|
||||
const gchar *icon;
|
||||
} icons[] = {
|
||||
{ "web_browser_image", "web-browser" },
|
||||
{ "mail_reader_image", "emblem-mail" },
|
||||
{ "media_player_image", "applications-multimedia" },
|
||||
{ "visual_image", "zoom-best-fit" },
|
||||
{ "mobility_image", "preferences-desktop-accessibility" },
|
||||
/* { "messenger_image", "im" },
|
||||
* { "image_image", "image-viewer" },
|
||||
* { "video_image", "gnome-multimedia" },
|
||||
* { "text_image", "text-editor" }, */
|
||||
{ "terminal_image", "gnome-terminal" }
|
||||
};
|
||||
|
||||
static void
|
||||
theme_changed_cb (GtkIconTheme *theme, GnomeDACapplet *capplet)
|
||||
{
|
||||
GObject *icon;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (icons); i++) {
|
||||
icon = gtk_builder_get_object (capplet->builder, icons[i].name);
|
||||
set_icon (GTK_IMAGE (icon), theme, icons[i].icon);
|
||||
}
|
||||
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers);
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers);
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players);
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals);
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats);
|
||||
refresh_combo_box_icons (theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats);
|
||||
}
|
||||
|
||||
static void
|
||||
screen_changed_cb (GtkWidget *widget, GdkScreen *screen, GnomeDACapplet *capplet)
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
|
||||
theme = gtk_icon_theme_get_for_screen (screen);
|
||||
|
||||
if (capplet->icon_theme != NULL) {
|
||||
g_signal_handlers_disconnect_by_func (capplet->icon_theme, theme_changed_cb, capplet);
|
||||
}
|
||||
g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet);
|
||||
theme_changed_cb (theme, capplet);
|
||||
|
||||
capplet->icon_theme = theme;
|
||||
}
|
||||
|
||||
static gint
|
||||
generic_item_comp (gconstpointer list_item, gconstpointer command)
|
||||
{
|
||||
return (strcmp (((GnomeDAItem *) list_item)->command, (gchar *) command));
|
||||
}
|
||||
|
||||
static gint
|
||||
web_item_comp (gconstpointer item, gconstpointer command)
|
||||
{
|
||||
GnomeDAWebItem *web_list_item;
|
||||
|
||||
web_list_item = (GnomeDAWebItem *) item;
|
||||
|
||||
if (strcmp (web_list_item->generic.command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
|
||||
if (web_list_item->netscape_remote) {
|
||||
if (strcmp (web_list_item->tab_command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
|
||||
if (strcmp (web_list_item->win_command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (strcmp (web_list_item->generic.command, (gchar *) command));
|
||||
}
|
||||
|
||||
static void
|
||||
web_gconf_changed_cb (GConfPropertyEditor *peditor, gchar *key, GConfValue *value, GnomeDACapplet *capplet)
|
||||
{
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
GList *list_entry;
|
||||
|
||||
/* This function is used to update HTTPS,ABOUT and UNKNOWN handlers, which
|
||||
* should also use the same value as HTTP
|
||||
*/
|
||||
|
||||
if (strcmp (key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) {
|
||||
gchar *short_browser, *pos;
|
||||
const gchar *value_str = gconf_value_get_string (value);
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_EXEC, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_EXEC, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_EXEC, value);
|
||||
pos = strstr (value_str, " ");
|
||||
if (pos == NULL)
|
||||
short_browser = g_strdup (value_str);
|
||||
else
|
||||
short_browser = g_strndup (value_str, pos - value_str);
|
||||
gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_BROWSER_EXEC, short_browser);
|
||||
g_free (short_browser);
|
||||
|
||||
list_entry = g_list_find_custom (capplet->web_browsers,
|
||||
value_str,
|
||||
(GCompareFunc) web_item_comp);
|
||||
|
||||
if (list_entry) {
|
||||
GnomeDAWebItem *item = (GnomeDAWebItem *) list_entry->data;
|
||||
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_BROWSER_NREMOTE, item->netscape_remote);
|
||||
}
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
}
|
||||
else if (strcmp (key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
|
||||
gconf_value_get_bool (value));
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM, value);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
web_browser_update_radio_buttons (GnomeDACapplet *capplet, const gchar *command)
|
||||
{
|
||||
GList *entry;
|
||||
gboolean has_net_remote;
|
||||
|
||||
entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
|
||||
|
||||
if (entry) {
|
||||
GnomeDAWebItem *item = (GnomeDAWebItem *) entry->data;
|
||||
|
||||
has_net_remote = item->netscape_remote;
|
||||
|
||||
if (has_net_remote) {
|
||||
/* disable "toggle" signal emitting, thus preventing calling this function twice */
|
||||
g_signal_handlers_block_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
g_signal_handlers_block_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
g_signal_handlers_block_matched (capplet->new_win_radiobutton,G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->default_radiobutton),
|
||||
strcmp (item->generic.command, command) == 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton),
|
||||
strcmp (item->tab_command, command) == 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton),
|
||||
strcmp (item->win_command, command) == 0);
|
||||
|
||||
g_signal_handlers_unblock_matched (capplet->default_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
g_signal_handlers_unblock_matched (capplet->new_tab_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
g_signal_handlers_unblock_matched (capplet->new_win_radiobutton, G_SIGNAL_MATCH_FUNC, 0,
|
||||
0, NULL, G_CALLBACK (web_radiobutton_toggled_cb), NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
has_net_remote = FALSE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
web_combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GList *entry, *handlers;
|
||||
const gchar *command;
|
||||
gint index;
|
||||
GnomeDACapplet *capplet;
|
||||
|
||||
g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
|
||||
|
||||
command = gconf_value_get_string (value);
|
||||
handlers = capplet->web_browsers;
|
||||
|
||||
if (handlers)
|
||||
{
|
||||
entry = g_list_find_custom (handlers, command, (GCompareFunc) web_item_comp);
|
||||
if (entry)
|
||||
index = g_list_position (handlers, entry);
|
||||
else
|
||||
index = g_list_length (handlers) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the item has no handlers lsit then select the Custom item */
|
||||
index = 1;
|
||||
}
|
||||
|
||||
web_browser_update_radio_buttons (capplet, command);
|
||||
|
||||
ret = gconf_value_new (GCONF_VALUE_INT);
|
||||
gconf_value_set_int (ret, index);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
web_combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GList *handlers;
|
||||
gint index;
|
||||
GnomeDAWebItem *item;
|
||||
const gchar *command;
|
||||
GnomeDACapplet *capplet;
|
||||
|
||||
g_object_get (G_OBJECT (peditor), "data", &capplet, NULL);
|
||||
|
||||
index = gconf_value_get_int (value);
|
||||
handlers = capplet->web_browsers;
|
||||
|
||||
item = g_list_nth_data (handlers, index);
|
||||
|
||||
ret = gconf_value_new (GCONF_VALUE_STRING);
|
||||
if (!item)
|
||||
{
|
||||
/* if item was not found, this is probably the "Custom" item */
|
||||
/* XXX: returning "" as the value here is not ideal, but required to
|
||||
* prevent the combo box from jumping back to the previous value if the
|
||||
* user has selected Custom */
|
||||
gconf_value_set_string (ret, "");
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && item->netscape_remote == TRUE)
|
||||
command = item->win_command;
|
||||
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && item->netscape_remote == TRUE)
|
||||
command = item->tab_command;
|
||||
else
|
||||
command = item->generic.command;
|
||||
|
||||
gconf_value_set_string (ret, command);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GList *entry, *handlers;
|
||||
const gchar *command;
|
||||
gint index;
|
||||
|
||||
g_object_get (G_OBJECT (peditor), "data", &handlers, NULL);
|
||||
|
||||
command = gconf_value_get_string (value);
|
||||
|
||||
if (handlers)
|
||||
{
|
||||
entry = g_list_find_custom (handlers, command, (GCompareFunc) generic_item_comp);
|
||||
if (entry)
|
||||
index = g_list_position (handlers, entry);
|
||||
else
|
||||
index = g_list_length (handlers) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if the item has no handlers lsit then select the Custom item */
|
||||
index = 1;
|
||||
}
|
||||
|
||||
ret = gconf_value_new (GCONF_VALUE_INT);
|
||||
gconf_value_set_int (ret, index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GList *handlers;
|
||||
gint index;
|
||||
GnomeDAItem *item;
|
||||
|
||||
g_object_get (G_OBJECT (peditor), "data", &handlers, NULL);
|
||||
index = gconf_value_get_int (value);
|
||||
|
||||
item = g_list_nth_data (handlers, index);
|
||||
ret = gconf_value_new (GCONF_VALUE_STRING);
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* if item was not found, this is probably the "Custom" item */
|
||||
|
||||
/* XXX: returning "" as the value here is not ideal, but required to
|
||||
* prevent the combo box from jumping back to the previous value if the
|
||||
* user has selected Custom */
|
||||
gconf_value_set_string (ret, "");
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
gconf_value_set_string (ret, item->command);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
combo_conv_from_widget_term_flag (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GList *handlers;
|
||||
gint index;
|
||||
GnomeDATermItem *item;
|
||||
|
||||
g_object_get (G_OBJECT (peditor), "data", &handlers, NULL);
|
||||
index = gconf_value_get_int (value);
|
||||
|
||||
item = g_list_nth_data (handlers, index);
|
||||
ret = gconf_value_new (GCONF_VALUE_STRING);
|
||||
|
||||
if (!item)
|
||||
{
|
||||
/* if item was not found, this is probably the "Custom" item */
|
||||
|
||||
/* XXX: returning "" as the value here is not ideal, but required to
|
||||
* prevent the combo box from jumping back to the previous value if the
|
||||
* user has selected Custom */
|
||||
gconf_value_set_string (ret, "");
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
gconf_value_set_string (ret, item->exec_flag);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
static GConfValue*
|
||||
combo_conv_to_widget_term_flag (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *ret;
|
||||
GtkComboBox *combo;
|
||||
|
||||
combo = GTK_COMBO_BOX (gconf_property_editor_get_ui_control (peditor));
|
||||
|
||||
ret = gconf_value_new (GCONF_VALUE_INT);
|
||||
gconf_value_set_int (ret, gtk_combo_box_get_active (combo));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_separator (GtkTreeModel *model, GtkTreeIter *iter, gpointer sep_index)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gboolean result;
|
||||
|
||||
path = gtk_tree_model_get_path (model, iter);
|
||||
result = gtk_tree_path_get_indices (path)[0] == GPOINTER_TO_INT (sep_index);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
|
||||
{
|
||||
GList *entry;
|
||||
GtkTreeModel *model;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeIter iter;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (theme == NULL) {
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
}
|
||||
|
||||
gtk_combo_box_set_row_separator_func (combo_box, is_separator,
|
||||
GINT_TO_POINTER (g_list_length (app_list)), NULL);
|
||||
|
||||
model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING));
|
||||
gtk_combo_box_set_model (combo_box, model);
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
|
||||
/* not all cells have a pixbuf, this prevents the combo box to shrink */
|
||||
gtk_cell_renderer_set_fixed_size (renderer, -1, 22);
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
|
||||
"pixbuf", PIXBUF_COL,
|
||||
NULL);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
|
||||
"text", TEXT_COL,
|
||||
NULL);
|
||||
|
||||
for (entry = app_list; entry != NULL; entry = g_list_next (entry)) {
|
||||
GnomeDAItem *item;
|
||||
item = (GnomeDAItem *) entry->data;
|
||||
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
PIXBUF_COL, pixbuf,
|
||||
TEXT_COL, item->name,
|
||||
-1);
|
||||
|
||||
item->icon_path = gtk_tree_model_get_string_from_iter (model, &iter);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1);
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
PIXBUF_COL, NULL,
|
||||
TEXT_COL, _("Custom"),
|
||||
-1);
|
||||
}
|
||||
|
||||
static GtkWidget*
|
||||
_gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
|
||||
{
|
||||
return GTK_WIDGET (gtk_builder_get_object (builder, name));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
|
||||
{
|
||||
GObject *obj;
|
||||
GtkBuilder *builder;
|
||||
guint builder_result;
|
||||
|
||||
capplet->builder = builder = gtk_builder_new ();
|
||||
|
||||
if (g_file_test (GNOMECC_UI_DIR "/gnome-default-applications-properties.ui", G_FILE_TEST_EXISTS) != FALSE) {
|
||||
builder_result = gtk_builder_add_from_file (builder, GNOMECC_UI_DIR "/gnome-default-applications-properties.ui", NULL);
|
||||
}
|
||||
else {
|
||||
builder_result = gtk_builder_add_from_file (builder, "./gnome-default-applications-properties.ui", NULL);
|
||||
}
|
||||
|
||||
if (builder_result == 0) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
|
||||
_("Could not load the main interface"));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("Please make sure that the applet "
|
||||
"is properly installed"));
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
capplet->window = _gtk_builder_get_widget (builder,"preferred_apps_dialog");
|
||||
|
||||
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_terminal_checkbutton = _gtk_builder_get_widget(builder, "web_browser_terminal_checkbutton");
|
||||
capplet->default_radiobutton = _gtk_builder_get_widget (builder, "web_browser_default_radiobutton");
|
||||
capplet->new_win_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_win_radiobutton");
|
||||
capplet->new_tab_radiobutton = _gtk_builder_get_widget (builder, "web_browser_new_tab_radiobutton");
|
||||
|
||||
capplet->mail_reader_command_entry = _gtk_builder_get_widget (builder, "mail_reader_command_entry");
|
||||
capplet->mail_reader_command_label = _gtk_builder_get_widget (builder, "mail_reader_command_label");
|
||||
capplet->mail_reader_terminal_checkbutton = _gtk_builder_get_widget (builder, "mail_reader_terminal_checkbutton");
|
||||
|
||||
capplet->terminal_command_entry = _gtk_builder_get_widget (builder, "terminal_command_entry");
|
||||
capplet->terminal_command_label = _gtk_builder_get_widget (builder, "terminal_command_label");
|
||||
capplet->terminal_exec_flag_entry = _gtk_builder_get_widget (builder, "terminal_exec_flag_entry");
|
||||
capplet->terminal_exec_flag_label = _gtk_builder_get_widget (builder, "terminal_exec_flag_label");
|
||||
|
||||
capplet->media_player_command_entry = _gtk_builder_get_widget (builder, "media_player_command_entry");
|
||||
capplet->media_player_command_label = _gtk_builder_get_widget (builder, "media_player_command_label");
|
||||
capplet->media_player_terminal_checkbutton = _gtk_builder_get_widget (builder, "media_player_terminal_checkbutton");
|
||||
|
||||
capplet->visual_command_entry = _gtk_builder_get_widget (builder, "visual_command_entry");
|
||||
capplet->visual_command_label = _gtk_builder_get_widget (builder, "visual_command_label");
|
||||
capplet->visual_startup_checkbutton = _gtk_builder_get_widget (builder, "visual_start_checkbutton");
|
||||
|
||||
capplet->mobility_command_entry = _gtk_builder_get_widget (builder, "mobility_command_entry");
|
||||
capplet->mobility_command_label = _gtk_builder_get_widget (builder, "mobility_command_label");
|
||||
capplet->mobility_startup_checkbutton = _gtk_builder_get_widget (builder, "mobility_start_checkbutton");
|
||||
|
||||
capplet->web_combo_box = _gtk_builder_get_widget (builder, "web_browser_combobox");
|
||||
capplet->mail_combo_box = _gtk_builder_get_widget (builder, "mail_reader_combobox");
|
||||
capplet->term_combo_box = _gtk_builder_get_widget (builder, "terminal_combobox");
|
||||
capplet->media_combo_box = _gtk_builder_get_widget (builder, "media_player_combobox");
|
||||
capplet->visual_combo_box = _gtk_builder_get_widget (builder, "visual_combobox");
|
||||
capplet->mobility_combo_box = _gtk_builder_get_widget (builder, "mobility_combobox");
|
||||
|
||||
g_signal_connect (capplet->window, "screen-changed", G_CALLBACK (screen_changed_cb), capplet);
|
||||
screen_changed_cb (capplet->window, gdk_screen_get_default (), capplet);
|
||||
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers);
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers);
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals);
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players);
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats);
|
||||
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats);
|
||||
|
||||
g_signal_connect (capplet->web_combo_box, "changed", G_CALLBACK (web_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->mail_combo_box, "changed", G_CALLBACK (mail_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->term_combo_box, "changed", G_CALLBACK (terminal_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->media_combo_box, "changed", G_CALLBACK (media_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->visual_combo_box, "changed", G_CALLBACK (visual_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->mobility_combo_box, "changed", G_CALLBACK (mobility_combo_changed_cb), capplet);
|
||||
|
||||
|
||||
g_signal_connect (capplet->default_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
g_signal_connect (capplet->new_win_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
g_signal_connect (capplet->new_tab_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
|
||||
/* Setup GConfPropertyEditors */
|
||||
|
||||
/* Web Browser */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_HTTP_EXEC,
|
||||
capplet->web_combo_box,
|
||||
"conv-from-widget-cb", web_combo_conv_from_widget,
|
||||
"conv-to-widget-cb", web_combo_conv_to_widget,
|
||||
"data", capplet,
|
||||
NULL);
|
||||
|
||||
obj = gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_HTTP_EXEC,
|
||||
capplet->web_browser_command_entry,
|
||||
NULL);
|
||||
g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
|
||||
|
||||
obj = gconf_peditor_new_boolean (NULL,
|
||||
DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
|
||||
capplet->web_browser_terminal_checkbutton,
|
||||
NULL);
|
||||
g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet);
|
||||
|
||||
/* Mailer */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_MAILER_EXEC,
|
||||
capplet->mail_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget,
|
||||
"conv-to-widget-cb", combo_conv_to_widget,
|
||||
"data", capplet->mail_readers,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_MAILER_EXEC,
|
||||
capplet->mail_reader_command_entry,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_boolean (NULL,
|
||||
DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
|
||||
capplet->mail_reader_terminal_checkbutton,
|
||||
NULL);
|
||||
|
||||
/* Media player */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_MEDIA_EXEC,
|
||||
capplet->media_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget,
|
||||
"conv-to-widget-cb", combo_conv_to_widget,
|
||||
"data", capplet->media_players,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_MEDIA_EXEC,
|
||||
capplet->media_player_command_entry,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_boolean (NULL,
|
||||
DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM,
|
||||
capplet->media_player_terminal_checkbutton,
|
||||
NULL);
|
||||
|
||||
/* Terminal */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_TERMINAL_EXEC,
|
||||
capplet->term_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget,
|
||||
"conv-to-widget-cb", combo_conv_to_widget,
|
||||
"data", capplet->terminals,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
|
||||
capplet->term_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget_term_flag,
|
||||
"conv-to-widget-cb", combo_conv_to_widget_term_flag,
|
||||
"data", capplet->terminals,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_TERMINAL_EXEC,
|
||||
capplet->terminal_command_entry,
|
||||
NULL);
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
|
||||
capplet->terminal_exec_flag_entry,
|
||||
NULL);
|
||||
|
||||
|
||||
/* Visual */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_VISUAL_EXEC,
|
||||
capplet->visual_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget,
|
||||
"conv-to-widget-cb", combo_conv_to_widget,
|
||||
"data", capplet->visual_ats,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_VISUAL_EXEC,
|
||||
capplet->visual_command_entry,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_boolean (NULL,
|
||||
DEFAULT_APPS_KEY_VISUAL_STARTUP,
|
||||
capplet->visual_startup_checkbutton,
|
||||
NULL);
|
||||
|
||||
|
||||
/* Mobility */
|
||||
gconf_peditor_new_combo_box (NULL,
|
||||
DEFAULT_APPS_KEY_MOBILITY_EXEC,
|
||||
capplet->mobility_combo_box,
|
||||
"conv-from-widget-cb", combo_conv_from_widget,
|
||||
"conv-to-widget-cb", combo_conv_to_widget,
|
||||
"data", capplet->mobility_ats,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_string (NULL,
|
||||
DEFAULT_APPS_KEY_MOBILITY_EXEC,
|
||||
capplet->mobility_command_entry,
|
||||
NULL);
|
||||
|
||||
gconf_peditor_new_boolean (NULL,
|
||||
DEFAULT_APPS_KEY_MOBILITY_STARTUP,
|
||||
capplet->mobility_startup_checkbutton,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (capplet->window),
|
||||
"gnome-settings-default-applications");
|
||||
|
||||
if (start_page != NULL) {
|
||||
gchar *page_name;
|
||||
GtkWidget *w;
|
||||
|
||||
page_name = g_strconcat (start_page, "_vbox", NULL);
|
||||
|
||||
w = _gtk_builder_get_widget (builder, page_name);
|
||||
if (w != NULL) {
|
||||
GtkNotebook *nb;
|
||||
gint pindex;
|
||||
|
||||
nb = GTK_NOTEBOOK (_gtk_builder_get_widget (builder,
|
||||
"preferred_apps_notebook"));
|
||||
pindex = gtk_notebook_page_num (nb, w);
|
||||
if (pindex != -1)
|
||||
gtk_notebook_set_current_page (nb, pindex);
|
||||
}
|
||||
g_free (page_name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_default_applications_panel_init (GnomeDACapplet *capplet)
|
||||
{
|
||||
gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers",
|
||||
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
|
||||
gconf_client_add_dir (capplet->gconf,
|
||||
"/desktop/gnome/applications",
|
||||
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
|
||||
|
||||
gnome_da_xml_load_list (capplet);
|
||||
|
||||
show_dialog (capplet, 0);
|
||||
}
|
127
panels/default-applications/gnome-da-capplet.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_CAPPLET_H_
|
||||
#define _GNOME_DA_CAPPLET_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
// Set http, https, about, and unknown keys to the chosen web browser.
|
||||
#define DEFAULT_APPS_KEY_HTTP_PATH "/desktop/gnome/url-handlers/http"
|
||||
#define DEFAULT_APPS_KEY_HTTP_NEEDS_TERM DEFAULT_APPS_KEY_HTTP_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTP_EXEC DEFAULT_APPS_KEY_HTTP_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_HTTPS_PATH "/desktop/gnome/url-handlers/https"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM DEFAULT_APPS_KEY_HTTPS_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_EXEC DEFAULT_APPS_KEY_HTTPS_PATH"/command"
|
||||
|
||||
// While gnome-vfs2 does not use the "unknown" key, several widespread apps like htmlview
|
||||
// have read it for the past few years. Setting it should not hurt.
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_PATH "/desktop/gnome/url-handlers/unknown"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM DEFAULT_APPS_KEY_UNKNOWN_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_EXEC DEFAULT_APPS_KEY_UNKNOWN_PATH"/command"
|
||||
|
||||
// about:blank and other about: URI's are commonly used by browsers too
|
||||
#define DEFAULT_APPS_KEY_ABOUT_PATH "/desktop/gnome/url-handlers/about"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM DEFAULT_APPS_KEY_ABOUT_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_EXEC DEFAULT_APPS_KEY_ABOUT_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_MAILER_PATH "/desktop/gnome/url-handlers/mailto"
|
||||
#define DEFAULT_APPS_KEY_MAILER_NEEDS_TERM DEFAULT_APPS_KEY_MAILER_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_MAILER_EXEC DEFAULT_APPS_KEY_MAILER_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_BROWSER_PATH "/desktop/gnome/applications/browser"
|
||||
#define DEFAULT_APPS_KEY_BROWSER_EXEC DEFAULT_APPS_KEY_BROWSER_PATH"/exec"
|
||||
#define DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM DEFAULT_APPS_KEY_BROWSER_PATH"/needs_term"
|
||||
#define DEFAULT_APPS_KEY_BROWSER_NREMOTE DEFAULT_APPS_KEY_BROWSER_PATH"/nremote"
|
||||
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_PATH "/desktop/gnome/applications/terminal"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG DEFAULT_APPS_KEY_TERMINAL_PATH"/exec_arg"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC DEFAULT_APPS_KEY_TERMINAL_PATH"/exec"
|
||||
|
||||
#define DEFAULT_APPS_KEY_MEDIA_PATH "/desktop/gnome/applications/media"
|
||||
#define DEFAULT_APPS_KEY_MEDIA_EXEC DEFAULT_APPS_KEY_MEDIA_PATH"/exec"
|
||||
#define DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM DEFAULT_APPS_KEY_MEDIA_PATH"/needs_term"
|
||||
|
||||
#define DEFAULT_APPS_KEY_VISUAL_PATH "/desktop/gnome/applications/at/visual"
|
||||
#define DEFAULT_APPS_KEY_VISUAL_EXEC DEFAULT_APPS_KEY_VISUAL_PATH"/exec"
|
||||
#define DEFAULT_APPS_KEY_VISUAL_STARTUP DEFAULT_APPS_KEY_VISUAL_PATH"/startup"
|
||||
|
||||
#define DEFAULT_APPS_KEY_MOBILITY_PATH "/desktop/gnome/applications/at/mobility"
|
||||
#define DEFAULT_APPS_KEY_MOBILITY_EXEC DEFAULT_APPS_KEY_MOBILITY_PATH"/exec"
|
||||
#define DEFAULT_APPS_KEY_MOBILITY_STARTUP DEFAULT_APPS_KEY_MOBILITY_PATH"/startup"
|
||||
|
||||
typedef struct _GnomeDACapplet GnomeDACapplet;
|
||||
|
||||
struct _GnomeDACapplet {
|
||||
GtkBuilder *builder;
|
||||
|
||||
GtkIconTheme *icon_theme;
|
||||
|
||||
GtkWidget *window;
|
||||
|
||||
GtkWidget *web_combo_box;
|
||||
GtkWidget *mail_combo_box;
|
||||
GtkWidget *term_combo_box;
|
||||
GtkWidget *media_combo_box;
|
||||
GtkWidget *visual_combo_box;
|
||||
GtkWidget *mobility_combo_box;
|
||||
|
||||
GtkWidget *web_browser_command_entry;
|
||||
GtkWidget *web_browser_command_label;
|
||||
GtkWidget *web_browser_terminal_checkbutton;
|
||||
GtkWidget *default_radiobutton;
|
||||
GtkWidget *new_win_radiobutton;
|
||||
GtkWidget *new_tab_radiobutton;
|
||||
|
||||
GtkWidget *mail_reader_command_entry;
|
||||
GtkWidget *mail_reader_command_label;
|
||||
GtkWidget *mail_reader_terminal_checkbutton;
|
||||
|
||||
GtkWidget *terminal_command_entry;
|
||||
GtkWidget *terminal_command_label;
|
||||
GtkWidget *terminal_exec_flag_entry;
|
||||
GtkWidget *terminal_exec_flag_label;
|
||||
|
||||
GtkWidget *media_player_command_entry;
|
||||
GtkWidget *media_player_command_label;
|
||||
GtkWidget *media_player_terminal_checkbutton;
|
||||
|
||||
GtkWidget *visual_command_entry;
|
||||
GtkWidget *visual_command_label;
|
||||
GtkWidget *visual_startup_checkbutton;
|
||||
|
||||
GtkWidget *mobility_command_entry;
|
||||
GtkWidget *mobility_command_label;
|
||||
GtkWidget *mobility_startup_checkbutton;
|
||||
|
||||
GConfClient *gconf;
|
||||
|
||||
GList *web_browsers;
|
||||
GList *mail_readers;
|
||||
GList *terminals;
|
||||
GList *media_players;
|
||||
GList *visual_ats;
|
||||
GList *mobility_ats;
|
||||
};
|
||||
|
||||
void gnome_default_applications_panel_init (GnomeDACapplet *capplet);
|
||||
#endif
|
148
panels/default-applications/gnome-da-item.c
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-item.h"
|
||||
|
||||
GnomeDAWebItem*
|
||||
gnome_da_web_item_new (void)
|
||||
{
|
||||
GnomeDAWebItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDAWebItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDASimpleItem*
|
||||
gnome_da_simple_item_new (void)
|
||||
{
|
||||
GnomeDASimpleItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDASimpleItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDATermItem*
|
||||
gnome_da_term_item_new (void)
|
||||
{
|
||||
GnomeDATermItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDATermItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDAVisualItem*
|
||||
gnome_da_visual_item_new (void)
|
||||
{
|
||||
GnomeDAVisualItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDAVisualItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDAMobilityItem*
|
||||
gnome_da_mobility_item_new (void)
|
||||
{
|
||||
GnomeDAMobilityItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDAMobilityItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_web_item_free (GnomeDAWebItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
g_free (item->generic.icon_path);
|
||||
|
||||
g_free (item->tab_command);
|
||||
g_free (item->win_command);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_simple_item_free (GnomeDASimpleItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
g_free (item->generic.icon_path);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_term_item_free (GnomeDATermItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
g_free (item->generic.icon_path);
|
||||
|
||||
g_free (item->exec_flag);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_visual_item_free (GnomeDAVisualItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
g_free (item->generic.icon_path);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_mobility_item_free (GnomeDAMobilityItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
g_free (item->generic.icon_path);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
81
panels/default-applications/gnome-da-item.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_ITEM_H_
|
||||
#define _GNOME_DA_ITEM_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _GnomeDAItem GnomeDAItem;
|
||||
|
||||
typedef struct _GnomeDAWebItem GnomeDAWebItem;
|
||||
typedef struct _GnomeDATermItem GnomeDATermItem;
|
||||
typedef struct _GnomeDASimpleItem GnomeDASimpleItem;
|
||||
typedef struct _GnomeDAVisualItem GnomeDAVisualItem;
|
||||
typedef struct _GnomeDAMobilityItem GnomeDAMobilityItem;
|
||||
|
||||
struct _GnomeDAItem {
|
||||
gchar *name;
|
||||
gchar *executable;
|
||||
gchar *command;
|
||||
gchar *icon_name;
|
||||
gchar *icon_path;
|
||||
};
|
||||
|
||||
struct _GnomeDAWebItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_in_terminal;
|
||||
gboolean netscape_remote;
|
||||
gchar *tab_command;
|
||||
gchar *win_command;
|
||||
};
|
||||
|
||||
struct _GnomeDASimpleItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_in_terminal;
|
||||
};
|
||||
|
||||
struct _GnomeDATermItem {
|
||||
GnomeDAItem generic;
|
||||
gchar *exec_flag;
|
||||
};
|
||||
|
||||
struct _GnomeDAVisualItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_at_startup;
|
||||
};
|
||||
|
||||
struct _GnomeDAMobilityItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_at_startup;
|
||||
};
|
||||
|
||||
GnomeDAWebItem* gnome_da_web_item_new (void);
|
||||
GnomeDATermItem* gnome_da_term_item_new (void);
|
||||
GnomeDASimpleItem* gnome_da_simple_item_new (void);
|
||||
GnomeDAVisualItem* gnome_da_visual_item_new (void);
|
||||
GnomeDAMobilityItem* gnome_da_mobility_item_new (void);
|
||||
void gnome_da_web_item_free (GnomeDAWebItem *item);
|
||||
void gnome_da_term_item_free (GnomeDATermItem *item);
|
||||
void gnome_da_simple_item_free (GnomeDASimpleItem *item);
|
||||
void gnome_da_visual_item_free (GnomeDAVisualItem *item);
|
||||
void gnome_da_mobility_item_free (GnomeDAMobilityItem *item);
|
||||
|
||||
#endif
|
323
panels/default-applications/gnome-da-xml.c
Normal file
|
@ -0,0 +1,323 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-xml.h"
|
||||
#include "gnome-da-item.h"
|
||||
|
||||
|
||||
static gboolean
|
||||
gnome_da_xml_get_bool (const xmlNode *parent, const gchar *val_name)
|
||||
{
|
||||
xmlNode *element;
|
||||
gboolean ret_val = FALSE;
|
||||
xmlChar *xml_val_name;
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (parent != NULL, FALSE);
|
||||
g_return_val_if_fail (parent->children != NULL, ret_val);
|
||||
g_return_val_if_fail (val_name != NULL, FALSE);
|
||||
|
||||
xml_val_name = xmlCharStrdup (val_name);
|
||||
len = xmlStrlen (xml_val_name);
|
||||
|
||||
for (element = parent->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, xml_val_name, len)) {
|
||||
xmlChar *cont = xmlNodeGetContent (element);
|
||||
|
||||
if (!xmlStrcasecmp (cont, "true") || !xmlStrcasecmp (cont, "1"))
|
||||
ret_val = TRUE;
|
||||
else
|
||||
ret_val = FALSE;
|
||||
|
||||
xmlFree (cont);
|
||||
}
|
||||
}
|
||||
|
||||
xmlFree (xml_val_name);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gnome_da_xml_get_string (const xmlNode *parent, const gchar *val_name)
|
||||
{
|
||||
const gchar * const *sys_langs;
|
||||
xmlChar *node_lang;
|
||||
xmlNode *element;
|
||||
gchar *ret_val = NULL;
|
||||
xmlChar *xml_val_name;
|
||||
gint len;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (parent != NULL, ret_val);
|
||||
g_return_val_if_fail (parent->children != NULL, ret_val);
|
||||
g_return_val_if_fail (val_name != NULL, ret_val);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 6, 0)
|
||||
sys_langs = g_get_language_names ();
|
||||
#endif
|
||||
|
||||
xml_val_name = xmlCharStrdup (val_name);
|
||||
len = xmlStrlen (xml_val_name);
|
||||
|
||||
for (element = parent->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, xml_val_name, len)) {
|
||||
node_lang = xmlNodeGetLang (element);
|
||||
|
||||
if (node_lang == NULL) {
|
||||
ret_val = (gchar *) xmlNodeGetContent (element);
|
||||
}
|
||||
else {
|
||||
for (i = 0; sys_langs[i] != NULL; i++) {
|
||||
if (!strcmp (sys_langs[i], node_lang)) {
|
||||
ret_val = (gchar *) xmlNodeGetContent (element);
|
||||
/* since sys_langs is sorted from most desirable to
|
||||
* least desirable, exit at first match
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlFree (node_lang);
|
||||
}
|
||||
}
|
||||
|
||||
xmlFree (xml_val_name);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_executable_valid (gchar *executable)
|
||||
{
|
||||
gchar *path;
|
||||
|
||||
path = g_find_program_in_path (executable);
|
||||
|
||||
if (path) {
|
||||
g_free (path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_da_xml_load_xml (GnomeDACapplet *capplet, const gchar * filename)
|
||||
{
|
||||
xmlDoc *xml_doc;
|
||||
xmlNode *root, *section, *element;
|
||||
gchar *executable;
|
||||
GnomeDAWebItem *web_item;
|
||||
GnomeDASimpleItem *mail_item;
|
||||
GnomeDASimpleItem *media_item;
|
||||
GnomeDATermItem *term_item;
|
||||
GnomeDAVisualItem *visual_item;
|
||||
GnomeDAMobilityItem *mobility_item;
|
||||
|
||||
xml_doc = xmlParseFile (filename);
|
||||
|
||||
if (!xml_doc)
|
||||
return;
|
||||
|
||||
root = xmlDocGetRootElement (xml_doc);
|
||||
|
||||
for (section = root->children; section != NULL; section = section->next) {
|
||||
if (!xmlStrncmp (section->name, "web-browsers", 12)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "web-browser", 11)) {
|
||||
executable = gnome_da_xml_get_string (element, "executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
web_item = gnome_da_web_item_new ();
|
||||
|
||||
web_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
web_item->generic.executable = executable;
|
||||
web_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
web_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
web_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
|
||||
web_item->netscape_remote = gnome_da_xml_get_bool (element, "netscape-remote");
|
||||
if (web_item->netscape_remote) {
|
||||
web_item->tab_command = gnome_da_xml_get_string (element, "tab-command");
|
||||
web_item->win_command = gnome_da_xml_get_string (element, "win-command");
|
||||
}
|
||||
|
||||
capplet->web_browsers = g_list_append (capplet->web_browsers, web_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "mail-readers", 12)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "mail-reader", 11)) {
|
||||
executable = gnome_da_xml_get_string (element, "executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
mail_item = gnome_da_simple_item_new ();
|
||||
|
||||
mail_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
mail_item->generic.executable = executable;
|
||||
mail_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
mail_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
mail_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
|
||||
|
||||
capplet->mail_readers = g_list_append (capplet->mail_readers, mail_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "terminals", 9)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "terminal", 8)) {
|
||||
executable = gnome_da_xml_get_string (element, "executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
term_item = gnome_da_term_item_new ();
|
||||
|
||||
term_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
term_item->generic.executable = executable;
|
||||
term_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
term_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
term_item->exec_flag = gnome_da_xml_get_string (element, "exec-flag");
|
||||
|
||||
capplet->terminals = g_list_append (capplet->terminals, term_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "media-players", 13)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "media-player", 12)) {
|
||||
executable = gnome_da_xml_get_string (element, "executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
media_item = gnome_da_simple_item_new ();
|
||||
|
||||
media_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
media_item->generic.executable = executable;
|
||||
media_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
media_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
media_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
|
||||
|
||||
capplet->media_players = g_list_append (capplet->media_players, media_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "a11y-visual", 11)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "visual", 6)) {
|
||||
executable = gnome_da_xml_get_string (element,"executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
visual_item = gnome_da_visual_item_new ();
|
||||
|
||||
visual_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
visual_item->generic.executable = executable;
|
||||
visual_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
visual_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
visual_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
|
||||
|
||||
capplet->visual_ats = g_list_append (capplet->visual_ats, visual_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "a11y-mobility", 13)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "mobility", 8)) {
|
||||
executable = gnome_da_xml_get_string (element,"executable");
|
||||
if (is_executable_valid (executable)) {
|
||||
mobility_item = gnome_da_mobility_item_new ();
|
||||
|
||||
mobility_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
mobility_item->generic.executable = executable;
|
||||
mobility_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
mobility_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
mobility_item->run_at_startup = gnome_da_xml_get_bool (element, "run-at-startup");
|
||||
|
||||
capplet->mobility_ats = g_list_append (capplet->mobility_ats, mobility_item);
|
||||
}
|
||||
else
|
||||
g_free (executable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlFreeDoc (xml_doc);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_xml_load_list (GnomeDACapplet *capplet)
|
||||
{
|
||||
GDir *app_dir = g_dir_open (GNOMECC_APPS_DIR, 0, NULL);
|
||||
|
||||
if (app_dir != NULL) {
|
||||
const gchar *extra_file;
|
||||
gchar *filename;
|
||||
|
||||
while ((extra_file = g_dir_read_name (app_dir)) != NULL) {
|
||||
filename = g_build_filename (GNOMECC_APPS_DIR, extra_file, NULL);
|
||||
|
||||
if (g_str_has_suffix (filename, ".xml"))
|
||||
gnome_da_xml_load_xml (capplet, filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
g_dir_close (app_dir);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_xml_free (GnomeDACapplet *capplet)
|
||||
{
|
||||
g_list_foreach (capplet->web_browsers, (GFunc) gnome_da_web_item_free, NULL);
|
||||
g_list_foreach (capplet->mail_readers, (GFunc) gnome_da_simple_item_free, NULL);
|
||||
g_list_foreach (capplet->terminals, (GFunc) gnome_da_term_item_free, NULL);
|
||||
g_list_foreach (capplet->media_players, (GFunc) gnome_da_simple_item_free, NULL);
|
||||
g_list_foreach (capplet->visual_ats, (GFunc) gnome_da_visual_item_free, NULL);
|
||||
g_list_foreach (capplet->mobility_ats, (GFunc) gnome_da_mobility_item_free, NULL);
|
||||
|
||||
g_list_free (capplet->web_browsers);
|
||||
g_list_free (capplet->mail_readers);
|
||||
g_list_free (capplet->terminals);
|
||||
g_list_free (capplet->media_players);
|
||||
g_list_free (capplet->visual_ats);
|
||||
g_list_free (capplet->mobility_ats);
|
||||
|
||||
g_object_unref (capplet->builder);
|
||||
g_free (capplet);
|
||||
}
|
27
panels/default-applications/gnome-da-xml.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* 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 Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_XML_H_
|
||||
#define _GNOME_DA_XML_H_
|
||||
|
||||
void gnome_da_xml_load_list (GnomeDACapplet *capplet);
|
||||
void gnome_da_xml_free (GnomeDACapplet *capplet);
|
||||
|
||||
#endif
|
1383
panels/default-applications/gnome-default-applications-properties.ui
Normal file
10
panels/default-applications/gnome-default-applications.pc.in
Normal file
|
@ -0,0 +1,10 @@
|
|||
prefix=@prefix@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@
|
||||
pkgdatadir=${datadir}/@PACKAGE@
|
||||
defappsdir=${pkgdatadir}/default-apps
|
||||
|
||||
Name: gnome-default-applications
|
||||
Description: Default GNOME applications configuration
|
||||
Version: @VERSION@
|
||||
|
434
panels/default-applications/gnome-default-applications.xml.in
Normal file
|
@ -0,0 +1,434 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE default-apps SYSTEM "gnome-da-list.dtd">
|
||||
<default-apps>
|
||||
|
||||
<!-- Remember to never use the same string for <command>, <tab-command> and <win-command> entries -->
|
||||
|
||||
<web-browsers>
|
||||
<web-browser>
|
||||
<_name>Opera</_name>
|
||||
<executable>opera</executable>
|
||||
<command>opera %s</command>
|
||||
<icon-name>opera</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>opera -newpage %s</tab-command>
|
||||
<win-command>opera -newwindow %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Debian Sensible Browser</_name>
|
||||
<executable>sensible-browser</executable>
|
||||
<command>sensible-browser %s</command>
|
||||
<icon-name></icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Epiphany Web Browser</_name>
|
||||
<executable>epiphany</executable>
|
||||
<command>epiphany %s</command>
|
||||
<icon-name>web-browser</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>epiphany --new-tab %s</tab-command>
|
||||
<win-command>epiphany --new-window %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Galeon</_name>
|
||||
<executable>galeon</executable>
|
||||
<command>galeon %s</command>
|
||||
<icon-name>galeon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>galeon -n %s</tab-command>
|
||||
<win-command>galeon -w %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Encompass</_name>
|
||||
<executable>encompass</executable>
|
||||
<command>encompass %s</command>
|
||||
<icon-name>encompass</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Firebird</_name>
|
||||
<executable>mozilla-firebird</executable>
|
||||
<command>mozilla-firebird %s</command>
|
||||
<icon-name></icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla-firebird -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla-firebird -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Firefox</_name>
|
||||
<executable>firefox</executable>
|
||||
<command>firefox %s</command>
|
||||
<icon-name>firefox</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>firefox -new-tab "%s"</tab-command>
|
||||
<win-command>firefox -new-window "%s"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Iceweasel</_name>
|
||||
<executable>iceweasel</executable>
|
||||
<command>iceweasel %s</command>
|
||||
<icon-name>iceweasel</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>iceweasel -new-tab "%s"</tab-command>
|
||||
<win-command>iceweasel -new-window "%s"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Mozilla 1.6</_name>
|
||||
<executable>mozilla-1.6</executable>
|
||||
<command>mozilla-1.6 %s</command>
|
||||
<icon-name>mozilla-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla-1.6 -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla-1.6 -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Mozilla</_name>
|
||||
<executable>mozilla</executable>
|
||||
<command>mozilla %s</command>
|
||||
<icon-name>mozilla-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>SeaMonkey</_name>
|
||||
<executable>seamonkey</executable>
|
||||
<command>seamonkey %s</command>
|
||||
<icon-name>seamonkey</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>seamonkey -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>seamonkey -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Iceape</_name>
|
||||
<executable>iceape</executable>
|
||||
<command>iceape %s</command>
|
||||
<icon-name>iceape</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>iceape -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>iceape -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Netscape Communicator</_name>
|
||||
<executable>netscape</executable>
|
||||
<command>netscape %s</command>
|
||||
<icon-name>netscape</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>netscape -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>netscape -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Konqueror</_name>
|
||||
<executable>konqueror</executable>
|
||||
<command>konqueror %s</command>
|
||||
<icon-name>konqueror</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Midori</_name>
|
||||
<executable>midori</executable>
|
||||
<command>midori %s</command>
|
||||
<icon-name>web-browser</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
</web-browsers>
|
||||
|
||||
<mail-readers>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader</_name>
|
||||
<executable>evolution</executable>
|
||||
<command>evolution %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Balsa</_name>
|
||||
<executable>balsa</executable>
|
||||
<command>balsa -m %s</command>
|
||||
<icon-name>gnome-balsa2</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>KMail</_name>
|
||||
<executable>kmail</executable>
|
||||
<command>kmail %s</command>
|
||||
<icon-name>kmail</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Icedove</_name>
|
||||
<executable>icedove</executable>
|
||||
<command>icedove %s</command>
|
||||
<icon-name>icedove</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Thunderbird</_name>
|
||||
<executable>thunderbird</executable>
|
||||
<command>thunderbird %s</command>
|
||||
<icon-name>thunderbird</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mozilla Thunderbird</_name>
|
||||
<executable>mozilla-thunderbird</executable>
|
||||
<command>mozilla-thunderbird %s</command>
|
||||
<icon-name>thunderbird</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mozilla Mail</_name>
|
||||
<executable>mozilla</executable>
|
||||
<command>mozilla -mail %s</command>
|
||||
<icon-name>mozilla-mail-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>SeaMonkey Mail</_name>
|
||||
<executable>seamonkey</executable>
|
||||
<command>seamonkey -mail %s</command>
|
||||
<icon-name>seamonkey</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Iceape Mail</_name>
|
||||
<executable>iceape</executable>
|
||||
<command>iceape -mail %s</command>
|
||||
<icon-name>iceape</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mutt</_name>
|
||||
<executable>mutt</executable>
|
||||
<command>mutt %s</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<run-in-terminal>true</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Claws Mail</_name>
|
||||
<executable>claws-mail</executable>
|
||||
<command>claws-mail --compose %s</command>
|
||||
<icon-name>claws-mail</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Sylpheed-Claws</_name>
|
||||
<executable>sylpheed-claws</executable>
|
||||
<command>sylpheed-claws --compose %s</command>
|
||||
<icon-name>sylpheed</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Sylpheed</_name>
|
||||
<executable>sylpheed</executable>
|
||||
<command>sylpheed --compose %s</command>
|
||||
<icon-name>sylpheed</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
</mail-readers>
|
||||
|
||||
<terminals>
|
||||
<terminal>
|
||||
<_name>Debian Terminal Emulator</_name>
|
||||
<executable>x-terminal-emulator</executable>
|
||||
<command>x-terminal-emulator</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>GNOME Terminal</_name>
|
||||
<executable>gnome-terminal</executable>
|
||||
<command>gnome-terminal</command>
|
||||
<icon-name>gnome-terminal</icon-name>
|
||||
<exec-flag>-x</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>Terminator</_name>
|
||||
<executable>terminator</executable>
|
||||
<command>terminator</command>
|
||||
<icon-name>terminator</icon-name>
|
||||
<exec-flag>-x</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>Standard XTerminal</_name>
|
||||
<executable>xterm</executable>
|
||||
<command>xterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>NXterm</_name>
|
||||
<executable>nxterm</executable>
|
||||
<command>nxterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>RXVT</_name>
|
||||
<executable>rxvt</executable>
|
||||
<command>rxvt</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>aterm</_name>
|
||||
<executable>aterm</executable>
|
||||
<command>aterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>ETerm</_name>
|
||||
<executable>ETerm</executable>
|
||||
<command>ETerm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>Konsole</_name>
|
||||
<executable>konsole</executable>
|
||||
<command>konsole</command>
|
||||
<icon-name>konsole</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
</terminals>
|
||||
|
||||
<media-players>
|
||||
<media-player>
|
||||
<_name>Banshee Music Player</_name>
|
||||
<executable>banshee</executable>
|
||||
<command>banshee</command>
|
||||
<icon-name>music-player-banshee</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</media-player>
|
||||
<media-player>
|
||||
<_name>Muine Music Player</_name>
|
||||
<executable>muine</executable>
|
||||
<command>muine</command>
|
||||
<icon-name>muine</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</media-player>
|
||||
<media-player>
|
||||
<_name>Rhythmbox Music Player</_name>
|
||||
<executable>rhythmbox</executable>
|
||||
<command>rhythmbox</command>
|
||||
<icon-name>rhythmbox</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</media-player>
|
||||
<media-player>
|
||||
<_name>Totem Movie Player</_name>
|
||||
<executable>totem</executable>
|
||||
<command>totem</command>
|
||||
<icon-name>totem</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</media-player>
|
||||
<media-player>
|
||||
<_name>Listen</_name>
|
||||
<executable>listen</executable>
|
||||
<command>listen</command>
|
||||
<icon-name>listen</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</media-player>
|
||||
</media-players>
|
||||
|
||||
<a11y-visual>
|
||||
<visual>
|
||||
<_name>Orca</_name>
|
||||
<executable>orca</executable>
|
||||
<command>orca</command>
|
||||
<icon-name>orca</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>Orca with Magnifier</_name>
|
||||
<executable>orca</executable>
|
||||
<command>orca -e magnifier</command>
|
||||
<icon-name>orca</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>Linux Screen Reader</_name>
|
||||
<executable>lsr</executable>
|
||||
<command>lsr</command>
|
||||
<icon-name>lsr</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>Linux Screen Reader with Magnifier</_name>
|
||||
<executable>lsr</executable>
|
||||
<command>lsr -p mag</command>
|
||||
<icon-name>lsr</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>Gnopernicus</_name>
|
||||
<executable>gnopernicus</executable>
|
||||
<command>gnopernicus</command>
|
||||
<icon-name>icon-accessibility</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>Gnopernicus with Magnifier</_name>
|
||||
<executable>gnopernicus</executable>
|
||||
<command>gnopernicus -m</command>
|
||||
<icon-name>icon-accessibility</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>GNOME Magnifier without Screen Reader</_name>
|
||||
<executable>magnifier</executable>
|
||||
<command>magnifier -m</command>
|
||||
<icon-name>gnome-searchtool</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
<visual>
|
||||
<_name>KDE Magnifier without Screen Reader</_name>
|
||||
<executable>kmag</executable>
|
||||
<command>kmag</command>
|
||||
<icon-name>gnome-searchtool</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</visual>
|
||||
|
||||
</a11y-visual>
|
||||
|
||||
<a11y-mobility>
|
||||
<mobility>
|
||||
<_name>GNOME OnScreen Keyboard</_name>
|
||||
<executable>gok</executable>
|
||||
<command>gok</command>
|
||||
<icon-name>accessibility-keyboard-capplet</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</mobility>
|
||||
<mobility>
|
||||
<_name>Dasher</_name>
|
||||
<executable>dasher</executable>
|
||||
<command>dasher</command>
|
||||
<icon-name>gnome-searchtool</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</mobility>
|
||||
<mobility>
|
||||
<name>onBoard</name>
|
||||
<executable>onboard</executable>
|
||||
<command>onboard</command>
|
||||
<icon-name>onboard</icon-name>
|
||||
<run-at-start>false</run-at-start>
|
||||
</mobility>
|
||||
</a11y-mobility>
|
||||
|
||||
</default-apps>
|
After Width: | Height: | Size: 748 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.8 KiB |
12680
panels/default-applications/icons/svg/preferred-applications.svg
Normal file
After Width: | Height: | Size: 400 KiB |