do not force CSD in dialogs

This commit is contained in:
guinux 2017-05-10 16:15:58 +02:00
parent 3f963bf4e6
commit 974cfe15ac
6 changed files with 52 additions and 9 deletions

View File

@ -15,13 +15,23 @@
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="spacing">6</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
<object class="GtkButton" id="close_button">
<property name="label" translatable="yes">_Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
@ -57,5 +67,11 @@
</child>
</object>
</child>
<action-widgets>
<action-widget response="-7">close_button</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</template>
</interface>

View File

@ -28,7 +28,9 @@ namespace Pamac {
public Gtk.ListStore pkgs_list;
public ChooseIgnorepkgsDialog (Gtk.Window window) {
Object (transient_for: window, use_header_bar: 1);
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
Object (transient_for: window, use_header_bar: use_header_bar);
pkgs_list = new Gtk.ListStore (2, typeof (bool), typeof (string));
treeview.set_model (pkgs_list);

View File

@ -23,7 +23,9 @@ namespace Pamac {
class ChooseProviderDialog : Gtk.Dialog {
public ChooseProviderDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 1);
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
Object (transient_for: window, use_header_bar: use_header_bar);
}
}
}

View File

@ -26,7 +26,9 @@ namespace Pamac {
public Gtk.TextView textview;
public HistoryDialog (Gtk.ApplicationWindow window) {
Object (transient_for: window, use_header_bar: 1);
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
Object (transient_for: window, use_header_bar: use_header_bar);
}
}
}

View File

@ -279,12 +279,15 @@ namespace Pamac {
}
public void run_about_dialog () {
string[] authors = {"Guillaume Benoit"};
Gtk.show_about_dialog (
application_window,
"program_name", "Pamac",
"icon_name", "system-software-install",
"logo_icon_name", "system-software-install",
"comments", dgettext (null, "A Gtk3 frontend for libalpm"),
"copyright", "Copyright © 2017 Guillaume Benoit",
"authors", authors,
"version", VERSION,
"license_type", Gtk.License.GPL_3_0,
"website", "http://github.com/manjaro/pamac");
@ -1481,9 +1484,17 @@ namespace Pamac {
void show_warnings () {
if (warning_textbuffer.len > 0) {
var flags = Gtk.DialogFlags.MODAL;
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
if (use_header_bar == 1) {
flags |= Gtk.DialogFlags.USE_HEADER_BAR;
}
var dialog = new Gtk.Dialog.with_buttons (dgettext (null, "Warning"),
application_window,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR);
flags);
dialog.border_width = 6;
dialog.icon_name = "system-software-install";
dialog.deletable = false;
unowned Gtk.Widget widget = dialog.add_button (dgettext (null, "_Close"), Gtk.ResponseType.CLOSE);
widget.can_focus = true;
@ -1508,9 +1519,17 @@ namespace Pamac {
}
void display_error (string message, string[] details) {
var flags = Gtk.DialogFlags.MODAL;
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
if (use_header_bar == 1) {
flags |= Gtk.DialogFlags.USE_HEADER_BAR;
}
var dialog = new Gtk.Dialog.with_buttons (message,
application_window,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR);
flags);
dialog.border_width = 6;
dialog.icon_name = "system-software-install";
var textbuffer = new StringBuilder ();
if (details.length != 0) {
show_in_term (message + ":");

View File

@ -30,7 +30,9 @@ namespace Pamac {
public Gtk.ListStore sum_list;
public TransactionSumDialog (Gtk.ApplicationWindow? window) {
Object (transient_for: window, use_header_bar: 1);
int use_header_bar;
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
Object (transient_for: window, use_header_bar: use_header_bar);
sum_list = new Gtk.ListStore (4, typeof (string), typeof (string), typeof (string), typeof (string));
treeview.set_model (sum_list);