Commit 072aad7d authored by Jonh Wendell's avatar Jonh Wendell Committed by Jonh Wendell S. Santana
Browse files

Added an initial preferences dialog.

2008-11-14  Jonh Wendell <jwendell@gnome.org>

	* lots of files: Added an initial preferences dialog.


svn path=/trunk/; revision=513
parent 892b1406
2008-11-14 Jonh Wendell <jwendell@gnome.org>
* lots of files: Added an initial preferences dialog.
2008-11-14 Jonh Wendell <jwendell@gnome.org>
* lots of files: Show a secondary text in all error dialogs.
......
......@@ -36,6 +36,10 @@
<menuitem name="MachineQuitMenu" action="MachineQuit"/>
</menu>
<menu name="EditMenu" action="Edit">
<menuitem name="EditPreferencesMenu" action="EditPreferences"/>
</menu>
<menu name="ViewMenu" action="View">
<menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
<menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
......
This diff is collapsed.
......@@ -66,7 +66,7 @@
<applyto>/apps/vinagre/show_accels</applyto>
<owner>vinagre</owner>
<type>bool</type>
<default>true</default>
<default>false</default>
<locale name="C">
<short>Whether we should show the menu accelerators (shortcut keys)</short>
<long>Set to "false" to disable menu shortcuts. Set to "true" to enable them. Note that if they are enabled, those keys will be intercepted by the menu and will not be sent to the remote host.</long>
......
......@@ -191,6 +191,14 @@ vinagre_cmd_machine_quit (GtkAction *action,
gtk_widget_destroy (GTK_WIDGET (window));
}
/* Edit Menu */
void
vinagre_cmd_edit_preferences (GtkAction *action,
VinagreWindow *window)
{
vinagre_prefs_dialog_show (window);
}
/* View Menu */
void
vinagre_cmd_view_show_toolbar (GtkAction *action,
......
......@@ -46,6 +46,9 @@ void vinagre_cmd_machine_close_all (GtkAction *action,
void vinagre_cmd_machine_quit (GtkAction *action,
VinagreWindow *window);
void vinagre_cmd_edit_preferences (GtkAction *action,
VinagreWindow *window);
void vinagre_cmd_view_show_toolbar (GtkAction *action,
VinagreWindow *window);
void vinagre_cmd_view_show_statusbar (GtkAction *action,
......
......@@ -20,7 +20,9 @@
#include <gconf/gconf-client.h>
#include <glib/gi18n.h>
#include <glade/glade.h>
#include "vinagre-prefs.h"
#include "vinagre-utils.h"
#define VINAGRE_BASE_KEY "/apps/vinagre"
#define VM_ALWAYS_SHOW_TABS VINAGRE_BASE_KEY "/always_show_tabs"
......@@ -368,7 +370,7 @@ vinagre_prefs_class_init (VinagrePrefsClass *klass)
g_param_spec_boolean ("show-accels",
"Show menu accelerators",
"Whether we should show the menu accelerators (keyboard shortcuts)",
TRUE,
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_HISTORY_SIZE,
......@@ -379,4 +381,86 @@ vinagre_prefs_class_init (VinagrePrefsClass *klass)
G_PARAM_READWRITE));
}
/* Preferences dialog */
typedef struct {
GladeXML *xml;
GtkWidget *dialog;
GtkWidget *show_tabs;
GtkWidget *show_accels;
} VinagrePrefsDialog;
static void
vinagre_prefs_dialog_setup (VinagrePrefsDialog *dialog)
{
gboolean show_accels, show_tabs;
g_object_get (vinagre_prefs_get_default (),
"show-accels", &show_accels,
"always-show-tabs", &show_tabs,
NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->show_accels), show_accels);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->show_tabs), show_tabs);
}
static void
vinagre_prefs_dialog_quit (VinagrePrefsDialog *dialog)
{
gtk_widget_destroy (dialog->dialog);
g_object_unref (dialog->xml);
g_free (dialog);
dialog = NULL;
}
static void
vinagre_prefs_dialog_show_tabs_cb (VinagrePrefsDialog *dialog)
{
g_object_set (vinagre_prefs_get_default (),
"always-show-tabs", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->show_tabs)),
NULL);
}
static void
vinagre_prefs_dialog_show_accels_cb (VinagrePrefsDialog *dialog)
{
g_object_set (vinagre_prefs_get_default (),
"show-accels", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->show_accels)),
NULL);
}
void
vinagre_prefs_dialog_show (VinagreWindow *window)
{
VinagrePrefsDialog *dialog;
dialog = g_new (VinagrePrefsDialog, 1);
dialog->xml = glade_xml_new (vinagre_utils_get_glade_filename (), NULL, NULL);
dialog->dialog = glade_xml_get_widget (dialog->xml, "preferences_dialog");
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), GTK_WINDOW (window));
dialog->show_tabs = glade_xml_get_widget (dialog->xml, "always_show_tabs_check");
dialog->show_accels = glade_xml_get_widget (dialog->xml, "show_accels_check");
vinagre_prefs_dialog_setup (dialog);
g_signal_connect_swapped (dialog->dialog,
"response",
G_CALLBACK (vinagre_prefs_dialog_quit),
dialog);
g_signal_connect_swapped (dialog->show_tabs,
"toggled",
G_CALLBACK (vinagre_prefs_dialog_show_tabs_cb),
dialog);
g_signal_connect_swapped (dialog->show_accels,
"toggled",
G_CALLBACK (vinagre_prefs_dialog_show_accels_cb),
dialog);
gtk_widget_show_all (dialog->dialog);
}
/* vim: set ts=8: */
......@@ -22,6 +22,7 @@
#define _VINAGRE_PREFS_H_
#include <glib-object.h>
#include "vinagre-window.h"
G_BEGIN_DECLS
......@@ -51,6 +52,7 @@ GType vinagre_prefs_get_type (void) G_GNUC_CONST;
VinagrePrefs *vinagre_prefs_get_default (void);
void vinagre_prefs_dialog_show (VinagreWindow *window);
G_END_DECLS
#endif /* _VINAGRE_PREFS_H_ */
......
......@@ -43,6 +43,10 @@ static const GtkActionEntry vinagre_always_sensitive_menu_entries[] =
N_("Open a .VNC file"), G_CALLBACK (vinagre_cmd_machine_open) },
{ "MachineQuit", GTK_STOCK_QUIT, NULL, "<control>Q",
N_("Quit the program"), G_CALLBACK (vinagre_cmd_machine_quit) },
/* Edit menu */
{ "EditPreferences", GTK_STOCK_PREFERENCES, NULL, NULL,
N_("Edit the application preferences"), G_CALLBACK (vinagre_cmd_edit_preferences) },
/* Bookmarks menu */
{ "BookmarksOpen", GTK_STOCK_CONNECT, N_("_Open bookmark"), NULL,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment