[evolution] EContactEditor: Move buttons to header bar
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EContactEditor: Move buttons to header bar
- Date: Thu, 21 Jul 2022 11:49:06 +0000 (UTC)
commit e96b1f51b288df8634c8684bd30151f2d184bab8
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Tue May 31 19:57:06 2022 +0200
EContactEditor: Move buttons to header bar
.../gui/contact-editor/contact-editor.ui | 82 +++++++++-------------
.../gui/contact-editor/e-contact-editor.c | 18 ++---
2 files changed, 39 insertions(+), 61 deletions(-)
---
diff --git a/src/addressbook/gui/contact-editor/contact-editor.ui
b/src/addressbook/gui/contact-editor/contact-editor.ui
index 6608640666..3fc8996e8b 100644
--- a/src/addressbook/gui/contact-editor/contact-editor.ui
+++ b/src/addressbook/gui/contact-editor/contact-editor.ui
@@ -124,16 +124,35 @@
<property name="title" translatable="yes">Contact Editor</property>
<property name="window_position">center</property>
<property name="type_hint">dialog</property>
+ <property name="use-header-bar">1</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <child internal-child="action_area">
+ <child internal-child="headerbar">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button-ok">
+ <property name="label" translatable="yes">_Save</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="has-default">True</property>
+ <property name="receives-default">False</property>
+ <property name="use-underline">True</property>
+ <accelerator key="s" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
<child>
<object class="GtkMenuButton" id="button-config">
<property name="visible">True</property>
@@ -157,65 +176,35 @@
</style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkButton" id="button-cancel">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button-ok">
- <property name="label" translatable="yes">_Save</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <accelerator key="s" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
<child>
<object class="GtkButton" id="button-help">
- <property name="label" translatable="yes">_Help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <child>
+ <object class="GtkImage" id="help-icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">help-browser</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkNotebook" id="notebook11">
@@ -2374,7 +2363,6 @@
</object>
</child>
<action-widgets>
- <action-widget response="-6">button-cancel</action-widget>
<action-widget response="-5">button-ok</action-widget>
<action-widget response="-11">button-help</action-widget>
</action-widgets>
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index d517f5f598..5061e29203 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -4804,13 +4804,6 @@ file_save_and_close_cb (GtkWidget *widget,
save_contact (ce, TRUE);
}
-static void
-file_cancel_cb (GtkWidget *widget,
- EContactEditor *ce)
-{
- eab_editor_close (EAB_EDITOR (ce));
-}
-
/* Callback used when the dialog box is destroyed */
static gint
app_delete_event_cb (GtkWidget *widget,
@@ -5053,8 +5046,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_window_set_type_hint (
GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_NORMAL);
- container = gtk_dialog_get_action_area (GTK_DIALOG (widget));
- gtk_container_set_border_width (GTK_CONTAINER (container), 12);
container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
gtk_container_set_border_width (GTK_CONTAINER (container), 0);
@@ -5087,14 +5078,13 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
widget = e_builder_get_widget (
e_contact_editor->priv->builder, "button-ok");
+ /* Already set in UI file but not working */
+ gtk_style_context_add_class (
+ gtk_widget_get_style_context (widget),
+ "suggested-action");
g_signal_connect (
widget, "clicked",
G_CALLBACK (file_save_and_close_cb), e_contact_editor);
- widget = e_builder_get_widget (
- e_contact_editor->priv->builder, "button-cancel");
- g_signal_connect (
- widget, "clicked",
- G_CALLBACK (file_cancel_cb), e_contact_editor);
widget = e_builder_get_widget (
e_contact_editor->priv->builder, "button-help");
g_signal_connect (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]