default applications: Remove selection of media player

This was only used to start the default media player on gnome-settings-daemon,
when the user presses the Media key. We just open the default for audio/ogg
there, so no need to ask the user for a default media player
This commit is contained in:
Rodrigo Moya 2010-10-13 15:28:33 +02:00
parent d7b59d3929
commit 556e483cf0
4 changed files with 10 additions and 483 deletions

View file

@ -111,20 +111,6 @@ mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
}
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)
{
@ -199,12 +185,9 @@ static struct {
} 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" }
};
@ -222,7 +205,6 @@ theme_changed_cb (GtkIconTheme *theme, GnomeDACapplet *capplet)
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);
@ -477,10 +459,6 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
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");
@ -492,7 +470,6 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
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");
@ -502,38 +479,17 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers, FALSE);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers, FALSE);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals, TRUE);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->media_combo_box), capplet->media_players, TRUE);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats, TRUE);
fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats, TRUE);
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);
/* Setup GConfPropertyEditors */
/* 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,
@ -627,8 +583,6 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page)
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);

View file

@ -24,35 +24,6 @@
#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"
@ -81,7 +52,6 @@ struct _GnomeDACapplet {
GtkWidget *web_combo_box;
GtkWidget *mail_combo_box;
GtkWidget *term_combo_box;
GtkWidget *media_combo_box;
GtkWidget *visual_combo_box;
GtkWidget *mobility_combo_box;
@ -90,10 +60,6 @@ struct _GnomeDACapplet {
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;
@ -107,7 +73,6 @@ struct _GnomeDACapplet {
GList *web_browsers;
GList *mail_readers;
GList *terminals;
GList *media_players;
GList *visual_ats;
GList *mobility_ats;
@ -115,4 +80,5 @@ struct _GnomeDACapplet {
};
void gnome_default_applications_panel_init (GnomeDACapplet *capplet);
#endif

View file

@ -129,7 +129,6 @@ gnome_da_xml_load_xml (GnomeDACapplet *capplet, const gchar * filename)
xmlDoc *xml_doc;
xmlNode *root, *section, *element;
gchar *executable;
GnomeDASimpleItem *media_item;
GnomeDATermItem *term_item;
GnomeDAVisualItem *visual_item;
GnomeDAMobilityItem *mobility_item;
@ -162,27 +161,6 @@ gnome_da_xml_load_xml (GnomeDACapplet *capplet, const gchar * filename)
g_free (executable);
}
}
}
else if (!xmlStrncmp (section->name, (const xmlChar *) "media-players", 13)) {
for (element = section->children; element != NULL; element = element->next) {
if (!xmlStrncmp (element->name, (const xmlChar *) "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, (const xmlChar *) "a11y-visual", 11)) {
for (element = section->children; element != NULL; element = element->next) {
@ -289,14 +267,12 @@ gnome_da_xml_free (GnomeDACapplet *capplet)
g_list_foreach (capplet->web_browsers, (GFunc) gnome_da_url_item_free, NULL);
g_list_foreach (capplet->mail_readers, (GFunc) gnome_da_url_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);

View file

@ -279,375 +279,6 @@
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="multimedia_vbox">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">18</property>
<child>
<object class="GtkVBox" id="image_vbox">
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="image_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Image Viewer</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="image_hbox">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="image_image">
<property name="visible">True</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="image_options_vbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBox" id="image_combobox">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="image_options_table">
<property name="visible">True</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="image_command_label">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">image_command_entry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="image_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">All %s occurrences will be replaced with actual link</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="image_terminal_checkbox">
<property name="label" translatable="yes">Run in t_erminal</property>
<property name="visible">True</property>
<property name="sensitive">False</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="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<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="media_player_vbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="media_player_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Multimedia Player</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="media_player_hbox">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="media_player_image">
<property name="visible">True</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="media_player_options_vbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBox" id="media_player_combobox">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="media_player_options_table">
<property name="visible">True</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="media_player_command_label">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">media_player_command_entry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="media_player_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">All %s occurrences will be replaced with actual link</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="media_player_terminal_checkbutton">
<property name="label" translatable="yes">Run in t_erminal</property>
<property name="visible">True</property>
<property name="sensitive">False</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="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="video_vbox">
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="video_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Video Player</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="video_hbox">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="video_image">
<property name="visible">True</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="video_options_vbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBox" id="video_combobox">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="video_options_table">
<property name="visible">True</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="video_command_label">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">video_command_entry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="video_command_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">All %s occurrences will be replaced with actual link</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="video_terminal_checkbox">
<property name="label" translatable="yes">Run in t_erminal</property>
<property name="visible">True</property>
<property name="sensitive">False</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="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="multimedia_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Multimedia</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="system_vbox">
<property name="visible">True</property>