diff --git a/src/settings-dialog.c b/src/settings-dialog.c index 8cd69e2..70b2481 100644 --- a/src/settings-dialog.c +++ b/src/settings-dialog.c @@ -15,44 +15,16 @@ #include #include +#include + #include "settings.h" #include "settings-dialog.h" #include "settings-dialog_ui.h" - - -typedef struct _XtmSettingsDialogClass XtmSettingsDialogClass; -struct _XtmSettingsDialogClass -{ - GtkWidgetClass parent_class; -}; -struct _XtmSettingsDialog -{ - GtkWidget parent; - /**/ - GtkWidget * window; - XtmSettings * settings; -}; -G_DEFINE_TYPE (XtmSettingsDialog, xtm_settings_dialog, GTK_TYPE_WIDGET) - -static void xtm_settings_dialog_finalize (GObject *object); -static void xtm_settings_dialog_show (GtkWidget *widget); -static void xtm_settings_dialog_hide (GtkWidget *widget); static void show_about_dialog (GtkWidget *widget); +static GtkWidget *xtm_settings_dialog_new (GtkBuilder *builder, GtkWidget *parent_window); -static void -xtm_settings_dialog_class_init (XtmSettingsDialogClass *klass) -{ - GObjectClass *class; - GtkWidgetClass *widget_class; - xtm_settings_dialog_parent_class = g_type_class_peek_parent (klass); - class = G_OBJECT_CLASS (klass); - class->finalize = xtm_settings_dialog_finalize; - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->show = xtm_settings_dialog_show; - widget_class->hide = xtm_settings_dialog_hide; -} static void button_toggled (GtkToggleButton *button, XtmSettings *settings) @@ -76,14 +48,6 @@ builder_bind_toggle_button (GtkBuilder *builder, gchar *widget_name, XtmSettings g_signal_connect (button, "toggled", G_CALLBACK (button_toggled), settings); } -static void -combobox_changed (GtkComboBox *combobox, XtmSettings *settings) -{ - gint active = gtk_combo_box_get_active (combobox); - gchar *setting_name = g_object_get_data (G_OBJECT (combobox), "setting-name"); - g_object_set (settings, setting_name, active, NULL); -} - static void show_about_dialog (GtkWidget *widget) { @@ -132,79 +96,46 @@ show_about_dialog (GtkWidget *widget) NULL); } -static void -xtm_settings_dialog_init (XtmSettingsDialog *dialog) +static GtkWidget * +xtm_settings_dialog_new (GtkBuilder *builder, GtkWidget *parent_window) { - GtkBuilder *builder; - GtkWidget *about; + GtkWidget *dialog; + GtkWidget *button; + XtmSettings *settings; - g_object_ref_sink (dialog); - - dialog->settings = xtm_settings_get_default (); - - builder = gtk_builder_new (); - gtk_builder_add_from_string (builder, settings_dialog_ui, settings_dialog_ui_length, NULL); - - dialog->window = GTK_WIDGET (gtk_builder_get_object (builder, "settings-dialog")); + settings = xtm_settings_get_default (); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "settings-dialog")); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window)); #ifndef HAVE_WNCK gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "button-show-application-icons"))); #endif - builder_bind_toggle_button (builder, "button-show-application-icons", dialog->settings, "show-application-icons"); - builder_bind_toggle_button (builder, "button-full-command-line", dialog->settings, "full-command-line"); - builder_bind_toggle_button (builder, "button-more-precision", dialog->settings, "more-precision"); - builder_bind_toggle_button (builder, "button-prompt-terminate-task", dialog->settings, "prompt-terminate-task"); - builder_bind_toggle_button (builder, "button-show-status-icon", dialog->settings, "show-status-icon"); - builder_bind_toggle_button (builder, "button-process-tree", dialog->settings, "process-tree"); + builder_bind_toggle_button (builder, "button-show-application-icons", settings, "show-application-icons"); + builder_bind_toggle_button (builder, "button-full-command-line", settings, "full-command-line"); + builder_bind_toggle_button (builder, "button-more-precision", settings, "more-precision"); + builder_bind_toggle_button (builder, "button-prompt-terminate-task", settings, "prompt-terminate-task"); + builder_bind_toggle_button (builder, "button-show-status-icon", settings, "show-status-icon"); + builder_bind_toggle_button (builder, "button-process-tree", settings, "process-tree"); - about = GTK_WIDGET (gtk_builder_get_object (builder, "button-about")); - g_signal_connect_swapped (about, "clicked", G_CALLBACK (show_about_dialog), dialog->window); + button = GTK_WIDGET (gtk_builder_get_object (builder, "button-about")); + g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_about_dialog), dialog); - g_object_unref (builder); -} - -static void -xtm_settings_dialog_finalize (GObject *object) -{ - XtmSettingsDialog *dialog = XTM_SETTINGS_DIALOG (object); - gtk_widget_destroy (dialog->window); - g_object_unref (dialog->settings); -} - - - -GtkWidget * -xtm_settings_dialog_new (GtkWindow *parent_window) -{ - GtkWidget *dialog = g_object_new (XTM_TYPE_SETTINGS_DIALOG, NULL); - gtk_window_set_transient_for (GTK_WINDOW (XTM_SETTINGS_DIALOG (dialog)->window), parent_window); return dialog; } -static void -xtm_settings_dialog_show (GtkWidget *widget) -{ - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (GTK_IS_WIDGET (XTM_SETTINGS_DIALOG (widget)->window)); - gtk_widget_show (XTM_SETTINGS_DIALOG (widget)->window); - gtk_window_present (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window)); -} - -static void -xtm_settings_dialog_hide (GtkWidget *widget) -{ - gint winx, winy; - g_return_if_fail (GTK_IS_WIDGET (widget)); - if (!GTK_IS_WIDGET (XTM_SETTINGS_DIALOG (widget)->window)) - return; - gtk_window_get_position (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window), &winx, &winy); - gtk_widget_hide (XTM_SETTINGS_DIALOG (widget)->window); - gtk_window_move (GTK_WINDOW (XTM_SETTINGS_DIALOG (widget)->window), winx, winy); -} - void -xtm_settings_dialog_run (XtmSettingsDialog *dialog) +xtm_settings_dialog_run (GtkWidget *parent_window) { - gtk_dialog_run (GTK_DIALOG (dialog->window)); + GtkBuilder *builder; + GtkWidget *dialog; + + builder = gtk_builder_new (); + gtk_builder_add_from_string (builder, settings_dialog_ui, settings_dialog_ui_length, NULL); + g_return_if_fail (GTK_IS_BUILDER (builder)); + + dialog = xtm_settings_dialog_new (builder, parent_window); + + g_object_unref (builder); + gtk_dialog_run (GTK_DIALOG (dialog)); } diff --git a/src/settings-dialog.h b/src/settings-dialog.h index 5074dac..a49114a 100644 --- a/src/settings-dialog.h +++ b/src/settings-dialog.h @@ -17,17 +17,6 @@ #include #include -#define XTM_TYPE_SETTINGS_DIALOG (xtm_settings_dialog_get_type ()) -#define XTM_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XTM_TYPE_SETTINGS_DIALOG, XtmSettingsDialog)) -#define XTM_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XTM_TYPE_SETTINGS_DIALOG, XtmSettingsDialogClass)) -#define XTM_IS_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XTM_TYPE_SETTINGS_DIALOG)) -#define XTM_IS_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XTM_TYPE_SETTINGS_DIALOG)) -#define XTM_SETTINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XTM_TYPE_SETTINGS_DIALOG, XtmSettingsDialogClass)) - -typedef struct _XtmSettingsDialog XtmSettingsDialog; - -GType xtm_settings_dialog_get_type (void); -GtkWidget * xtm_settings_dialog_new (GtkWindow *parent_window); -void xtm_settings_dialog_run (XtmSettingsDialog *dialog); +void xtm_settings_dialog_run (GtkWidget *parent_window); #endif /* !SETTINGS_DIALOG_H */ diff --git a/src/settings-dialog.ui b/src/settings-dialog.ui index dddbaf1..c97cc56 100644 --- a/src/settings-dialog.ui +++ b/src/settings-dialog.ui @@ -19,29 +19,20 @@ False - 5 Task Manager Settings - False - True - True - gtk-preferences - normal - - - + org.xfce.taskmanager + dialog - - True + False vertical 2 - - True + False - spread + end - + _Help True True @@ -86,151 +77,239 @@ - True - True - end + False + False 0 - + True - True - False + False + 6 - + True False - 6 + vertical + 6 - + True False - vertical - 6 + 0 + none - + True False - 0 - none + 6 + 12 - + True False - 6 - 12 + vertical + 6 - + + Show application icons True - False - vertical - 6 - - - Show application icons - True - True - False - 0.5 - True - - - False - True - 0 - - - - - Show full command lines - True - True - False - 0.5 - True - - - False - False - 1 - - - - - Show values with more precision - True - True - False - 0.5 - True - - - False - False - 2 - - - - - Show processes as tree - True - True - False - 0.5 - True - - - False - False - 4 - - + True + False + 0.5 + True + + False + True + 0 + + + + + Show full command lines + True + True + False + 0.5 + True + + + False + False + 1 + + + + + Show values with more precision + True + True + False + 0.5 + True + + + False + False + 2 + + + + + Show processes as tree + True + True + False + 0.5 + True + + + False + False + 4 + - - - True - False - <b>Interface style</b> - True - - - - False - False - 0 - - - + + True False - 0 - none + <b>Interface style</b> + True + + + + + False + False + 0 + + + + + True + False + 0 + none + + + True + False + 6 + 12 - + True False - 6 - 12 + vertical + 6 - + + Prompt for terminating tasks + True + True + False + 0.5 + True + + + False + False + 0 + + + + + Hide into the notification area + True + True + False + 0.5 + True + + + False + False + 1 + + + + + + + + + True + False + <b>Miscellaneous</b> + True + + + + + False + False + 1 + + + + + False + True + 0 + + + + + False + vertical + + + False + True + 6 + 1 + + + + + False + vertical + 6 + + + True + False + False + 0 + none + + + True + False + 6 + 12 + + + True + False + vertical + 6 + + True False - vertical 6 - - Prompt for terminating tasks + True - True - False - 0.5 - True + False + Refresh rate: False @@ -239,13 +318,9 @@ - - Hide into the notification area + True - True - False - 0.5 - True + False False @@ -254,23 +329,66 @@ + + False + False + 0 + + + + + True + False + Columns: + 0 + + + False + False + 1 + + + + + True + False + 12 + + + True + True + never + never + in + + + True + True + + + + + + + + + + False + True + 2 + - - - True - False - <b>Miscellaneous</b> - True - - - - False - False - 1 - + + + + True + False + <b>Information</b> + True + @@ -279,170 +397,13 @@ 0 - - - False - vertical - - - False - True - 6 - 1 - - - - - False - vertical - 6 - - - True - False - False - 0 - none - - - True - False - 6 - 12 - - - True - False - vertical - 6 - - - True - False - 6 - - - True - False - Refresh rate: - - - False - False - 0 - - - - - True - False - - - False - False - 1 - - - - - False - False - 0 - - - - - True - False - Columns: - 0 - - - False - False - 1 - - - - - True - False - 12 - - - True - True - never - never - in - - - True - True - - - - - - - - - - False - True - 2 - - - - - - - - - True - False - <b>Information</b> - True - - - - - False - True - 0 - - - - - False - True - 2 - - - - - - - True - False - Settings - False + False + True + 2 - - - - - - - - - - - - False diff --git a/src/settings-tool-button.c b/src/settings-tool-button.c index e5e265c..e5c8af6 100644 --- a/src/settings-tool-button.c +++ b/src/settings-tool-button.c @@ -65,9 +65,8 @@ static void show_settings_dialog (XtmSettingsToolButton *button) { GtkWidget *parent_window = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW); - GtkWidget *dialog = xtm_settings_dialog_new (GTK_WINDOW (parent_window)); - xtm_settings_dialog_run (XTM_SETTINGS_DIALOG (dialog)); - g_object_unref (dialog); + + xtm_settings_dialog_run (parent_window); } static void diff --git a/src/settings.c b/src/settings.c index 96510ef..f825470 100644 --- a/src/settings.c +++ b/src/settings.c @@ -100,8 +100,6 @@ xtm_settings_class_init (XtmSettingsClass *klass) g_param_spec_boolean ("monitor-paint-box", "MonitorPaintBox", "Paint box around monitor", TRUE, G_PARAM_READWRITE)); g_object_class_install_property (class, PROP_SHOW_APPLICATION_ICONS, g_param_spec_boolean ("show-application-icons", "ShowApplicationIcons", "Show application icons", TRUE, G_PARAM_READWRITE)); - g_object_class_install_property (class, PROP_TOOLBAR_STYLE, - g_param_spec_enum ("toolbar-style", "ToolbarStyle", "Toolbar style", XTM_TYPE_TOOLBAR_STYLE, XTM_TOOLBAR_STYLE_DEFAULT, G_PARAM_READWRITE)); g_object_class_install_property (class, PROP_PROMPT_TERMINATE_TASK, g_param_spec_boolean ("prompt-terminate-task", "PromptTerminateTask", "Prompt dialog for terminating a task", TRUE, G_PARAM_READWRITE)); g_object_class_install_property (class, PROP_REFRESH_RATE,