Compare commits
7 Commits
release-42
...
media-pane
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7378256fee | ||
|
|
507ad4a8db | ||
|
|
31949a78ec | ||
|
|
5c2d2b07bb | ||
|
|
8d7fa44b7e | ||
|
|
d7129d6343 | ||
|
|
090e197fa1 |
@@ -340,6 +340,8 @@ panels/keyboard/gnome-keyboard-panel.desktop.in
|
||||
panels/keyboard/gnome-keybindings.pc
|
||||
panels/region/Makefile
|
||||
panels/region/gnome-region-panel.desktop.in
|
||||
panels/media/Makefile
|
||||
panels/media/gnome-media-panel.desktop.in
|
||||
panels/mouse/Makefile
|
||||
panels/mouse/gnome-mouse-panel.desktop.in
|
||||
panels/network/Makefile
|
||||
|
||||
@@ -2,6 +2,7 @@ SUBDIRS= \
|
||||
background \
|
||||
screen \
|
||||
display \
|
||||
media \
|
||||
mouse \
|
||||
region \
|
||||
network \
|
||||
|
||||
38
panels/media/Makefile.am
Normal file
38
panels/media/Makefile.am
Normal file
@@ -0,0 +1,38 @@
|
||||
# This is used in GNOMECC_CAPPLETS_CFLAGS
|
||||
cappletname = media
|
||||
|
||||
ccpanelsdir = $(PANELS_DIR)
|
||||
ccpanels_LTLIBRARIES = libmedia.la
|
||||
|
||||
libmedia_la_SOURCES = \
|
||||
media-module.c \
|
||||
cc-media-panel.c \
|
||||
cc-media-panel.h \
|
||||
nautilus-open-with-dialog.c \
|
||||
nautilus-open-with-dialog.h
|
||||
|
||||
libmedia_la_LIBADD = \
|
||||
$(PANEL_LIBS)
|
||||
|
||||
libmedia_la_LDFLAGS = $(PANEL_LDFLAGS)
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
uidir = $(pkgdatadir)/ui
|
||||
dist_ui_DATA = gnome-media-properties.ui
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
Desktop_in_files = gnome-media-panel.desktop.in
|
||||
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
INCLUDES = \
|
||||
$(GNOMECC_CAPPLETS_CFLAGS) \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\"\
|
||||
-DGNOMECC_UI_DIR=\""$(uidir)"\"
|
||||
|
||||
CLEANFILES = \
|
||||
$(GNOMECC_CAPPLETS_CLEANFILES) \
|
||||
$(Desktop_in_files) \
|
||||
$(desktop_DATA)
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
797
panels/media/cc-media-panel.c
Normal file
797
panels/media/cc-media-panel.c
Normal file
@@ -0,0 +1,797 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2010 Red Hat, 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: David Zeuthen <davidz@redhat.com>
|
||||
* Cosimo Cecchi <cosimoc@gnome.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cc-media-panel.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "nautilus-open-with-dialog.h"
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (CcMediaPanel, cc_media_panel, CC_TYPE_PANEL)
|
||||
|
||||
#define MEDIA_PANEL_PRIVATE(o) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_MEDIA_PANEL, CcMediaPanelPrivate))
|
||||
|
||||
/* Autorun options */
|
||||
#define PREF_MEDIA_AUTORUN_NEVER "autorun-never"
|
||||
#define PREF_MEDIA_AUTORUN_X_CONTENT_START_APP "autorun-x-content-start-app"
|
||||
#define PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE "autorun-x-content-ignore"
|
||||
#define PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
|
||||
|
||||
enum {
|
||||
AUTORUN_ASK,
|
||||
AUTORUN_IGNORE,
|
||||
AUTORUN_APP,
|
||||
AUTORUN_OPEN_FOLDER,
|
||||
AUTORUN_SEP,
|
||||
AUTORUN_OTHER_APP,
|
||||
};
|
||||
|
||||
enum {
|
||||
COLUMN_AUTORUN_GICON,
|
||||
COLUMN_AUTORUN_NAME,
|
||||
COLUMN_AUTORUN_APP_INFO,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE,
|
||||
COLUMN_AUTORUN_ITEM_TYPE,
|
||||
};
|
||||
|
||||
struct _CcMediaPanelPrivate {
|
||||
GtkBuilder *builder;
|
||||
GSettings *preferences;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
guint changed_signal_id;
|
||||
GtkWidget *combo_box;
|
||||
|
||||
char *x_content_type;
|
||||
|
||||
gboolean other_application_selected;
|
||||
CcMediaPanel *self;
|
||||
} AutorunComboBoxData;
|
||||
|
||||
static void
|
||||
prepare_combo_box (CcMediaPanel *self,
|
||||
GtkWidget *combo_box,
|
||||
const char *x_content_type);
|
||||
|
||||
static void
|
||||
cc_media_panel_dispose (GObject *object)
|
||||
{
|
||||
CcMediaPanel *self = CC_MEDIA_PANEL (object);
|
||||
|
||||
if (self->priv->builder != NULL) {
|
||||
g_object_unref (self->priv->builder);
|
||||
self->priv->builder = NULL;
|
||||
}
|
||||
|
||||
if (self->priv->preferences != NULL) {
|
||||
g_object_unref (self->priv->preferences);
|
||||
self->priv->preferences = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (cc_media_panel_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_media_panel_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (cc_media_panel_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_media_panel_class_init (CcMediaPanelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (CcMediaPanelPrivate));
|
||||
|
||||
object_class->dispose = cc_media_panel_dispose;
|
||||
object_class->finalize = cc_media_panel_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
cc_media_panel_class_finalize (CcMediaPanelClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
remove_elem_from_str_array (char **v, const char *s)
|
||||
{
|
||||
int n, m;
|
||||
|
||||
if (v == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (n = 0; v[n] != NULL; n++) {
|
||||
if (g_strcmp0 (v[n], s) == 0) {
|
||||
for (m = n + 1; v[m] != NULL; m++) {
|
||||
v[m - 1] = v[m];
|
||||
}
|
||||
v[m - 1] = NULL;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char **
|
||||
add_elem_to_str_array (char **v, const char *s)
|
||||
{
|
||||
guint len;
|
||||
char **r;
|
||||
|
||||
len = v != NULL ? g_strv_length (v) : 0;
|
||||
r = g_new0 (char *, len + 2);
|
||||
memcpy (r, v, len * sizeof (char *));
|
||||
r[len] = g_strdup (s);
|
||||
r[len+1] = NULL;
|
||||
g_free (v);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
update_media_sensitivity (CcMediaPanel *self)
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (self->priv->builder, "media_handling_vbox")),
|
||||
! g_settings_get_boolean (self->priv->preferences, PREF_MEDIA_AUTORUN_NEVER));
|
||||
}
|
||||
|
||||
static void
|
||||
autorun_set_preferences (CcMediaPanel *self,
|
||||
const char *x_content_type,
|
||||
gboolean pref_start_app,
|
||||
gboolean pref_ignore,
|
||||
gboolean pref_open_folder)
|
||||
{
|
||||
char **x_content_start_app;
|
||||
char **x_content_ignore;
|
||||
char **x_content_open_folder;
|
||||
|
||||
g_assert (x_content_type != NULL);
|
||||
|
||||
x_content_start_app = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
|
||||
x_content_ignore = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
|
||||
x_content_open_folder = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
|
||||
|
||||
remove_elem_from_str_array (x_content_start_app, x_content_type);
|
||||
if (pref_start_app) {
|
||||
x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type);
|
||||
}
|
||||
g_settings_set_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app);
|
||||
|
||||
remove_elem_from_str_array (x_content_ignore, x_content_type);
|
||||
if (pref_ignore) {
|
||||
x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type);
|
||||
}
|
||||
g_settings_set_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore);
|
||||
|
||||
remove_elem_from_str_array (x_content_open_folder, x_content_type);
|
||||
if (pref_open_folder) {
|
||||
x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type);
|
||||
}
|
||||
g_settings_set_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) x_content_open_folder);
|
||||
|
||||
g_strfreev (x_content_open_folder);
|
||||
g_strfreev (x_content_ignore);
|
||||
g_strfreev (x_content_start_app);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
autorun_rebuild_combo_box (AutorunComboBoxData *data)
|
||||
{
|
||||
char *x_content_type;
|
||||
|
||||
x_content_type = g_strdup (data->x_content_type);
|
||||
prepare_combo_box (data->self,
|
||||
data->combo_box,
|
||||
x_content_type);
|
||||
|
||||
g_free (x_content_type);
|
||||
}
|
||||
|
||||
static void
|
||||
other_application_selected (NautilusOpenWithDialog *dialog,
|
||||
GAppInfo *app_info,
|
||||
AutorunComboBoxData *data)
|
||||
{
|
||||
autorun_set_preferences (data->self, data->x_content_type, TRUE, FALSE, FALSE);
|
||||
g_app_info_set_as_default_for_type (app_info,
|
||||
data->x_content_type,
|
||||
NULL);
|
||||
data->other_application_selected = TRUE;
|
||||
|
||||
/* rebuild so we include and select the new application in the list */
|
||||
autorun_rebuild_combo_box (data);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_dialog_closure (AutorunComboBoxData *data)
|
||||
{
|
||||
if (!data->other_application_selected) {
|
||||
/* reset combo box so we don't linger on "Open with other Application..." */
|
||||
autorun_rebuild_combo_box (data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
combo_box_changed (GtkComboBox *combo_box,
|
||||
AutorunComboBoxData *data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GAppInfo *app_info;
|
||||
char *x_content_type;
|
||||
int type;
|
||||
CcMediaPanel *self = data->self;
|
||||
|
||||
model = NULL;
|
||||
app_info = NULL;
|
||||
x_content_type = NULL;
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
model = gtk_combo_box_get_model (combo_box);
|
||||
if (model == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_AUTORUN_APP_INFO, &app_info,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, &x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, &type,
|
||||
-1);
|
||||
|
||||
switch (type) {
|
||||
case AUTORUN_ASK:
|
||||
autorun_set_preferences (self, x_content_type,
|
||||
FALSE, FALSE, FALSE);
|
||||
break;
|
||||
case AUTORUN_IGNORE:
|
||||
autorun_set_preferences (self, x_content_type,
|
||||
FALSE, TRUE, FALSE);
|
||||
break;
|
||||
case AUTORUN_OPEN_FOLDER:
|
||||
autorun_set_preferences (self, x_content_type,
|
||||
FALSE, FALSE, TRUE);
|
||||
break;
|
||||
|
||||
case AUTORUN_APP:
|
||||
autorun_set_preferences (self, x_content_type,
|
||||
TRUE, FALSE, FALSE);
|
||||
g_app_info_set_as_default_for_type (app_info,
|
||||
x_content_type,
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case AUTORUN_OTHER_APP:
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
data->other_application_selected = FALSE;
|
||||
|
||||
dialog = nautilus_add_application_dialog_new (NULL, x_content_type);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (data->self))));
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
g_signal_connect (dialog, "application_selected",
|
||||
G_CALLBACK (other_application_selected),
|
||||
data);
|
||||
g_signal_connect_swapped (dialog, "response",
|
||||
G_CALLBACK (handle_dialog_closure), data);
|
||||
g_signal_connect_swapped (dialog, "destroy",
|
||||
G_CALLBACK (handle_dialog_closure), data);
|
||||
gtk_widget_show (GTK_WIDGET (dialog));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (app_info != NULL) {
|
||||
g_object_unref (app_info);
|
||||
}
|
||||
|
||||
g_free (x_content_type);
|
||||
}
|
||||
|
||||
static void
|
||||
other_type_combo_box_changed (GtkComboBox *combo_box,
|
||||
CcMediaPanel *self)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
char *x_content_type;
|
||||
GtkWidget *action_combo_box;
|
||||
|
||||
x_content_type = NULL;
|
||||
|
||||
if (!gtk_combo_box_get_active_iter (combo_box, &iter)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
model = gtk_combo_box_get_model (combo_box);
|
||||
if (model == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
2, &x_content_type,
|
||||
-1);
|
||||
|
||||
action_combo_box = GTK_WIDGET (gtk_builder_get_object (self->priv->builder,
|
||||
"media_other_action_combobox"));
|
||||
|
||||
prepare_combo_box (self, action_combo_box,
|
||||
x_content_type);
|
||||
out:
|
||||
g_free (x_content_type);
|
||||
}
|
||||
|
||||
static int
|
||||
eel_g_strv_find (char **strv,
|
||||
const char *find_me)
|
||||
{
|
||||
int index;
|
||||
|
||||
g_return_val_if_fail (find_me != NULL, -1);
|
||||
|
||||
for (index = 0; strv[index] != NULL; ++index) {
|
||||
if (g_strcmp0 (strv[index], find_me) == 0) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
autorun_get_preferences (CcMediaPanel *self,
|
||||
const char *x_content_type,
|
||||
gboolean *pref_start_app,
|
||||
gboolean *pref_ignore,
|
||||
gboolean *pref_open_folder)
|
||||
{
|
||||
char **x_content_start_app;
|
||||
char **x_content_ignore;
|
||||
char **x_content_open_folder;
|
||||
|
||||
g_return_if_fail (pref_start_app != NULL);
|
||||
g_return_if_fail (pref_ignore != NULL);
|
||||
g_return_if_fail (pref_open_folder != NULL);
|
||||
|
||||
*pref_start_app = FALSE;
|
||||
*pref_ignore = FALSE;
|
||||
*pref_open_folder = FALSE;
|
||||
x_content_start_app = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_START_APP);
|
||||
x_content_ignore = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_IGNORE);
|
||||
x_content_open_folder = g_settings_get_strv (self->priv->preferences,
|
||||
PREF_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER);
|
||||
if (x_content_start_app != NULL) {
|
||||
*pref_start_app = eel_g_strv_find (x_content_start_app, x_content_type) != -1;
|
||||
}
|
||||
if (x_content_ignore != NULL) {
|
||||
*pref_ignore = eel_g_strv_find (x_content_ignore, x_content_type) != -1;
|
||||
}
|
||||
if (x_content_open_folder != NULL) {
|
||||
*pref_open_folder = eel_g_strv_find (x_content_open_folder, x_content_type) != -1;
|
||||
}
|
||||
g_strfreev (x_content_ignore);
|
||||
g_strfreev (x_content_start_app);
|
||||
g_strfreev (x_content_open_folder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
combo_box_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
char *str;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
1, &str,
|
||||
-1);
|
||||
|
||||
if (str != NULL) {
|
||||
g_free (str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
autorun_combobox_data_destroy (AutorunComboBoxData *data)
|
||||
{
|
||||
/* signal handler may be automatically disconnected by destroying the widget */
|
||||
if (g_signal_handler_is_connected (data->combo_box, data->changed_signal_id)) {
|
||||
g_signal_handler_disconnect (data->combo_box, data->changed_signal_id);
|
||||
}
|
||||
g_free (data->x_content_type);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_combo_box (CcMediaPanel *self,
|
||||
GtkWidget *combo_box,
|
||||
const char *x_content_type)
|
||||
{
|
||||
GList *l;
|
||||
GList *app_info_list;
|
||||
GAppInfo *default_app_info;
|
||||
GtkListStore *list_store;
|
||||
GtkTreeIter iter;
|
||||
GIcon *icon;
|
||||
int set_active;
|
||||
int n;
|
||||
int num_apps;
|
||||
gboolean pref_ask;
|
||||
gboolean pref_start_app;
|
||||
gboolean pref_ignore;
|
||||
gboolean pref_open_folder;
|
||||
AutorunComboBoxData *data;
|
||||
GtkCellRenderer *renderer;
|
||||
gboolean new_data;
|
||||
|
||||
autorun_get_preferences (self, x_content_type,
|
||||
&pref_start_app, &pref_ignore, &pref_open_folder);
|
||||
pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
|
||||
|
||||
set_active = -1;
|
||||
data = NULL;
|
||||
new_data = TRUE;
|
||||
|
||||
app_info_list = g_app_info_get_all_for_type (x_content_type);
|
||||
default_app_info = g_app_info_get_default_for_type (x_content_type, FALSE);
|
||||
num_apps = g_list_length (app_info_list);
|
||||
|
||||
list_store = gtk_list_store_new (5,
|
||||
G_TYPE_ICON,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_APP_INFO,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_INT);
|
||||
|
||||
/* no apps installed */
|
||||
if (num_apps == 0) {
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
icon = g_themed_icon_new (GTK_STOCK_DIALOG_ERROR);
|
||||
|
||||
/* TODO: integrate with PackageKit-gnome to find applications */
|
||||
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, _("No applications found"),
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
|
||||
-1);
|
||||
g_object_unref (icon);
|
||||
} else {
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
icon = g_themed_icon_new (GTK_STOCK_DIALOG_QUESTION);
|
||||
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, _("Ask what to do"),
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_ASK,
|
||||
-1);
|
||||
g_object_unref (icon);
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
icon = g_themed_icon_new (GTK_STOCK_CLOSE);
|
||||
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, _("Do Nothing"),
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_IGNORE,
|
||||
-1);
|
||||
g_object_unref (icon);
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
icon = g_themed_icon_new ("folder-open");
|
||||
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, _("Open Folder"),
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OPEN_FOLDER,
|
||||
-1);
|
||||
g_object_unref (icon);
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, NULL,
|
||||
COLUMN_AUTORUN_NAME, NULL,
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_SEP,
|
||||
-1);
|
||||
|
||||
for (l = app_info_list, n = 4; l != NULL; l = l->next, n++) {
|
||||
char *open_string;
|
||||
GAppInfo *app_info = l->data;
|
||||
|
||||
/* we deliberately ignore should_show because some apps might want
|
||||
* to install special handlers that should be hidden in the regular
|
||||
* application launcher menus
|
||||
*/
|
||||
|
||||
icon = g_app_info_get_icon (app_info);
|
||||
open_string = g_strdup_printf (_("Open %s"), g_app_info_get_display_name (app_info));
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, open_string,
|
||||
COLUMN_AUTORUN_APP_INFO, app_info,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_APP,
|
||||
-1);
|
||||
|
||||
g_free (open_string);
|
||||
|
||||
if (g_app_info_equal (app_info, default_app_info)) {
|
||||
set_active = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, NULL,
|
||||
COLUMN_AUTORUN_NAME, NULL,
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, NULL,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_SEP,
|
||||
-1);
|
||||
|
||||
gtk_list_store_append (list_store, &iter);
|
||||
icon = g_themed_icon_new ("application-x-executable");
|
||||
|
||||
gtk_list_store_set (list_store, &iter,
|
||||
COLUMN_AUTORUN_GICON, icon,
|
||||
COLUMN_AUTORUN_NAME, _("Open with other Application..."),
|
||||
COLUMN_AUTORUN_APP_INFO, NULL,
|
||||
COLUMN_AUTORUN_X_CONTENT_TYPE, x_content_type,
|
||||
COLUMN_AUTORUN_ITEM_TYPE, AUTORUN_OTHER_APP,
|
||||
-1);
|
||||
g_object_unref (icon);
|
||||
|
||||
if (default_app_info != NULL) {
|
||||
g_object_unref (default_app_info);
|
||||
}
|
||||
g_list_free_full (app_info_list, g_object_unref);
|
||||
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
|
||||
g_object_unref (list_store);
|
||||
|
||||
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box));
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
|
||||
"gicon", COLUMN_AUTORUN_GICON,
|
||||
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", COLUMN_AUTORUN_NAME,
|
||||
NULL);
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo_box), combo_box_separator_func, NULL, NULL);
|
||||
|
||||
if (num_apps == 0) {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
|
||||
gtk_widget_set_sensitive (combo_box, FALSE);
|
||||
} else {
|
||||
gtk_widget_set_sensitive (combo_box, TRUE);
|
||||
if (pref_ask) {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
|
||||
} else if (pref_ignore) {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1);
|
||||
} else if (pref_open_folder) {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 2);
|
||||
} else if (set_active != -1) {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), set_active);
|
||||
} else {
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1);
|
||||
}
|
||||
|
||||
/* See if we have an old data around */
|
||||
data = g_object_get_data (G_OBJECT (combo_box), "autorun_combobox_data");
|
||||
if (data) {
|
||||
new_data = FALSE;
|
||||
g_free (data->x_content_type);
|
||||
} else {
|
||||
data = g_new0 (AutorunComboBoxData, 1);
|
||||
}
|
||||
|
||||
data->x_content_type = g_strdup (x_content_type);
|
||||
data->combo_box = combo_box;
|
||||
data->self = self;
|
||||
|
||||
if (data->changed_signal_id == 0) {
|
||||
data->changed_signal_id = g_signal_connect (combo_box,
|
||||
"changed",
|
||||
G_CALLBACK (combo_box_changed),
|
||||
data);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_data) {
|
||||
g_object_set_data_full (G_OBJECT (combo_box),
|
||||
"autorun_combobox_data",
|
||||
data,
|
||||
(GDestroyNotify) autorun_combobox_data_destroy);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
media_panel_setup (CcMediaPanel *self)
|
||||
{
|
||||
guint n;
|
||||
GList *l, *content_types;
|
||||
GtkWidget *other_type_combo_box;
|
||||
GtkListStore *other_type_list_store;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeIter iter;
|
||||
GtkBuilder *builder = self->priv->builder;
|
||||
const char *s[] = {"media_audio_cdda_combobox", "x-content/audio-cdda",
|
||||
"media_video_dvd_combobox", "x-content/video-dvd",
|
||||
"media_music_player_combobox", "x-content/audio-player",
|
||||
"media_dcf_combobox", "x-content/image-dcf",
|
||||
"media_software_combobox", "x-content/software",
|
||||
NULL};
|
||||
|
||||
for (n = 0; s[n*2] != NULL; n++) {
|
||||
prepare_combo_box (self,
|
||||
GTK_WIDGET (gtk_builder_get_object (builder, s[n*2])),
|
||||
s[n*2 + 1]);
|
||||
}
|
||||
|
||||
other_type_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "media_other_type_combobox"));
|
||||
|
||||
other_type_list_store = gtk_list_store_new (3,
|
||||
G_TYPE_ICON,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store),
|
||||
1, GTK_SORT_ASCENDING);
|
||||
|
||||
|
||||
content_types = g_content_types_get_registered ();
|
||||
|
||||
for (l = content_types; l != NULL; l = l->next) {
|
||||
char *content_type = l->data;
|
||||
char *description;
|
||||
GIcon *icon;
|
||||
|
||||
if (!g_str_has_prefix (content_type, "x-content/"))
|
||||
continue;
|
||||
for (n = 0; s[n*2] != NULL; n++) {
|
||||
if (strcmp (content_type, s[n*2 + 1]) == 0) {
|
||||
goto skip;
|
||||
}
|
||||
}
|
||||
|
||||
description = g_content_type_get_description (content_type);
|
||||
gtk_list_store_append (other_type_list_store, &iter);
|
||||
icon = g_content_type_get_icon (content_type);
|
||||
|
||||
gtk_list_store_set (other_type_list_store, &iter,
|
||||
0, icon,
|
||||
1, description,
|
||||
2, content_type,
|
||||
-1);
|
||||
g_free (description);
|
||||
g_object_unref (icon);
|
||||
skip:
|
||||
;
|
||||
}
|
||||
|
||||
g_list_free_full (content_types, g_free);
|
||||
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box),
|
||||
GTK_TREE_MODEL (other_type_list_store));
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
|
||||
"gicon", 0,
|
||||
NULL);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box), renderer,
|
||||
"text", 1,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (other_type_combo_box,
|
||||
"changed",
|
||||
G_CALLBACK (other_type_combo_box_changed),
|
||||
self);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box), 0);
|
||||
|
||||
update_media_sensitivity (self);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_media_panel_init (CcMediaPanel *self)
|
||||
{
|
||||
CcMediaPanelPrivate *priv;
|
||||
GtkWidget *main_widget;
|
||||
guint res;
|
||||
|
||||
priv = self->priv = MEDIA_PANEL_PRIVATE (self);
|
||||
priv->builder = gtk_builder_new ();
|
||||
priv->preferences = g_settings_new ("org.gnome.media-handling");
|
||||
|
||||
/* support developers that want to run from the current directory */
|
||||
if (g_file_test (GNOMECC_UI_DIR "/gnome-media-properties.ui", G_FILE_TEST_EXISTS) != FALSE) {
|
||||
res = gtk_builder_add_from_file (priv->builder, GNOMECC_UI_DIR "/gnome-media-properties.ui", NULL);
|
||||
} else {
|
||||
res = gtk_builder_add_from_file (priv->builder, "./gnome-media-properties.ui", NULL);
|
||||
}
|
||||
|
||||
/* TODO: error */
|
||||
if (res == 0) {
|
||||
g_critical ("Unable to load the UI file!");
|
||||
}
|
||||
|
||||
media_panel_setup (self);
|
||||
|
||||
main_widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
|
||||
"media_preferences_vbox"));
|
||||
gtk_widget_reparent (main_widget, (GtkWidget *) self);
|
||||
}
|
||||
|
||||
void
|
||||
cc_media_panel_register (GIOModule *module)
|
||||
{
|
||||
cc_media_panel_register_type (G_TYPE_MODULE (module));
|
||||
g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
|
||||
CC_TYPE_MEDIA_PANEL,
|
||||
"media", 0);
|
||||
}
|
||||
|
||||
73
panels/media/cc-media-panel.h
Normal file
73
panels/media/cc-media-panel.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Red Hat, 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: Cosimo Cecchi <cosimoc@gnome.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CC_MEDIA_PANEL_H
|
||||
#define _CC_MEDIA_PANEL_H
|
||||
|
||||
#include <libgnome-control-center/cc-panel.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CC_TYPE_MEDIA_PANEL cc_media_panel_get_type()
|
||||
|
||||
#define CC_MEDIA_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CC_TYPE_MEDIA_PANEL, CcMediaPanel))
|
||||
|
||||
#define CC_MEDIA_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CC_TYPE_MEDIA_PANEL, CcMediaPanelClass))
|
||||
|
||||
#define CC_IS_MEDIA_PANEL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CC_TYPE_MEDIA_PANEL))
|
||||
|
||||
#define CC_IS_MEDIA_PANEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CC_TYPE_MEDIA_PANEL))
|
||||
|
||||
#define CC_MEDIA_PANEL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CC_TYPE_MEDIA_PANEL, CcMediaPanelClass))
|
||||
|
||||
typedef struct _CcMediaPanel CcMediaPanel;
|
||||
typedef struct _CcMediaPanelClass CcMediaPanelClass;
|
||||
typedef struct _CcMediaPanelPrivate CcMediaPanelPrivate;
|
||||
|
||||
struct _CcMediaPanel
|
||||
{
|
||||
CcPanel parent;
|
||||
|
||||
CcMediaPanelPrivate *priv;
|
||||
};
|
||||
|
||||
struct _CcMediaPanelClass
|
||||
{
|
||||
CcPanelClass parent_class;
|
||||
};
|
||||
|
||||
GType cc_media_panel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void cc_media_panel_register (GIOModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _CC_MEDIA_PANEL_H */
|
||||
15
panels/media/gnome-media-panel.desktop.in.in
Normal file
15
panels/media/gnome-media-panel.desktop.in.in
Normal file
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
_Name=Media and Autorun
|
||||
_Comment=Configure media and autorun preferences
|
||||
Exec=gnome-control-center media
|
||||
Icon=drive-optical
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=GNOME;GTK;Settings;X-GNOME-PersonalSettings;X-GNOME-Settings-Panel;
|
||||
OnlyShowIn=GNOME;
|
||||
X-GNOME-Bugzilla-Bugzilla=GNOME
|
||||
X-GNOME-Bugzilla-Product=gnome-control-center
|
||||
X-GNOME-Bugzilla-Component=Media and autorun
|
||||
X-GNOME-Bugzilla-Version=@VERSION@
|
||||
X-GNOME-Settings-Panel=media
|
||||
384
panels/media/gnome-media-properties.ui
Normal file
384
panels/media/gnome-media-properties.ui
Normal file
@@ -0,0 +1,384 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkDialog" id="media_preferences_dialog">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Media and Autorun</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="media_preferences_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="media_handling_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox44">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label42">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Media Handling</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment18">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox52">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label60">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Choose what happens when inserting media or connecting devices to the system</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="table4">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label44">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">CD _audio:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_audio_cdda_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label50">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_DVD video:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_video_dvd_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_audio_cdda_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_video_dvd_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label54">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Music player:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_music_player_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_music_player_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label59">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Photos:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_dcf_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_dcf_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label57">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Software:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_software_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_software_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox50">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label61">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Other Media</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment20">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox51">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label65">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Less common media formats can be configured here</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTable" id="table5">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_other_type_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label64">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Acti_on:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_other_action_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="media_other_action_combobox">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label63">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Type:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">media_other_type_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="media_autorun_never_checkbutton">
|
||||
<property name="label" translatable="yes">_Never prompt or start programs on media insertion</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="media_automount_open_checkbutton">
|
||||
<property name="label" translatable="yes">B_rowse media when inserted</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area1"/>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
41
panels/media/media-module.c
Normal file
41
panels/media/media-module.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Red Hat, 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: Cosimo Cecchi <cosimoc@gnome.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cc-media-panel.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
/* register the panel */
|
||||
cc_media_panel_register (module);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
1093
panels/media/nautilus-open-with-dialog.c
Normal file
1093
panels/media/nautilus-open-with-dialog.c
Normal file
File diff suppressed because it is too large
Load Diff
64
panels/media/nautilus-open-with-dialog.h
Normal file
64
panels/media/nautilus-open-with-dialog.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/*
|
||||
nautilus-open-with-dialog.c: an open-with dialog
|
||||
|
||||
Copyright (C) 2004 Novell, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Dave Camp <dave@novell.com>
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_OPEN_WITH_DIALOG_H
|
||||
#define NAUTILUS_OPEN_WITH_DIALOG_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define NAUTILUS_TYPE_OPEN_WITH_DIALOG (nautilus_open_with_dialog_get_type ())
|
||||
#define NAUTILUS_OPEN_WITH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_OPEN_WITH_DIALOG, NautilusOpenWithDialog))
|
||||
#define NAUTILUS_OPEN_WITH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_OPEN_WITH_DIALOG, NautilusOpenWithDialogClass))
|
||||
#define NAUTILUS_IS_OPEN_WITH_DIALOG(obj) (G_TYPE_INSTANCE_CHECK_TYPE ((obj), NAUTILUS_TYPE_OPEN_WITH_DIALOG)
|
||||
|
||||
typedef struct _NautilusOpenWithDialog NautilusOpenWithDialog;
|
||||
typedef struct _NautilusOpenWithDialogClass NautilusOpenWithDialogClass;
|
||||
typedef struct _NautilusOpenWithDialogDetails NautilusOpenWithDialogDetails;
|
||||
|
||||
struct _NautilusOpenWithDialog {
|
||||
GtkDialog parent;
|
||||
NautilusOpenWithDialogDetails *details;
|
||||
};
|
||||
|
||||
struct _NautilusOpenWithDialogClass {
|
||||
GtkDialogClass parent_class;
|
||||
|
||||
void (*application_selected) (NautilusOpenWithDialog *dialog,
|
||||
GAppInfo *application);
|
||||
};
|
||||
|
||||
GType nautilus_open_with_dialog_get_type (void);
|
||||
GtkWidget* nautilus_open_with_dialog_new (const char *uri,
|
||||
const char *mime_type,
|
||||
const char *extension);
|
||||
GtkWidget* nautilus_add_application_dialog_new (const char *uri,
|
||||
const char *mime_type);
|
||||
GtkWidget* nautilus_add_application_dialog_new_for_multiple_files (const char *extension,
|
||||
const char *mime_type);
|
||||
|
||||
|
||||
|
||||
#endif /* NAUTILUS_OPEN_WITH_DIALOG_H */
|
||||
Reference in New Issue
Block a user