gnome appmenu
This commit is contained in:
parent
90ffcb5fd3
commit
83b7223d7b
@ -88,113 +88,12 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkPopoverMenu" id="popovermenu_global">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="menu_box_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="border_width">6</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<property name="spacing">6</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="refresh_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">Refresh databases</property>
|
|
||||||
<signal name="clicked" handler="on_refresh_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="history_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">View History</property>
|
|
||||||
<signal name="clicked" handler="on_history_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="local_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">Install Local Packages</property>
|
|
||||||
<signal name="clicked" handler="on_local_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="preferences_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">Preferences</property>
|
|
||||||
<signal name="clicked" handler="on_preferences_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="about_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">About</property>
|
|
||||||
<signal name="clicked" handler="on_about_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkModelButton" id="quit_button_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="text" translatable="yes">Quit</property>
|
|
||||||
<signal name="clicked" handler="on_quit_button_clicked" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">5</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="submenu">main</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<template class="PamacManagerWindow" parent="GtkApplicationWindow">
|
<template class="PamacManagerWindow" parent="GtkApplicationWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">False</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="default_height">500</property>
|
<property name="default_height">500</property>
|
||||||
<property name="icon_name">system-software-install</property>
|
<property name="icon_name">system-software-install</property>
|
||||||
<property name="gravity">center</property>
|
<property name="gravity">center</property>
|
||||||
<property name="show_menubar">False</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="main_box">
|
<object class="GtkBox" id="main_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -1124,25 +1023,6 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="show_close_button">True</property>
|
<property name="show_close_button">True</property>
|
||||||
<child>
|
|
||||||
<object class="GtkMenuButton" id="button_menu_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">False</property>
|
|
||||||
<property name="popover">popovermenu_global</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkImage" id="menu_icon_global">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="icon_name">system-software-install</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<style>
|
|
||||||
<class name="image-button"/>
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="button_back">
|
<object class="GtkButton" id="button_back">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Pamac {
|
namespace Pamac {
|
||||||
|
|
||||||
class Manager : Gtk.Application {
|
class Manager : Gtk.Application {
|
||||||
ManagerWindow manager_window;
|
ManagerWindow manager_window;
|
||||||
bool pamac_run;
|
bool pamac_run;
|
||||||
@ -48,6 +47,23 @@ namespace Pamac {
|
|||||||
msg.destroy ();
|
msg.destroy ();
|
||||||
} else {
|
} else {
|
||||||
manager_window = new ManagerWindow (this);
|
manager_window = new ManagerWindow (this);
|
||||||
|
|
||||||
|
#if ENABLE_HAMBURGER
|
||||||
|
#else
|
||||||
|
var menu = new Menu ();
|
||||||
|
menu.append (dgettext (null, "Refresh Databases"), "win.refreshdb");
|
||||||
|
menu.append (dgettext (null, "View History"), "win.viewhistory");
|
||||||
|
menu.append (dgettext (null, "Install Local Packages"), "win.installlocal");
|
||||||
|
menu.append (dgettext (null, "Preferences"), "win.preferences");
|
||||||
|
menu.append (dgettext (null, "About"), "win.about");
|
||||||
|
menu.append (dgettext (null, "Quit"), "app.quit");
|
||||||
|
this.app_menu = menu;
|
||||||
|
|
||||||
|
var quit_action = new SimpleAction ("quit", null);
|
||||||
|
quit_action.activate.connect (this.quit);
|
||||||
|
this.add_action (quit_action);
|
||||||
|
#endif
|
||||||
|
|
||||||
// quit accel
|
// quit accel
|
||||||
var action = new SimpleAction ("quit", null);
|
var action = new SimpleAction ("quit", null);
|
||||||
action.activate.connect (() => {this.quit ();});
|
action.activate.connect (() => {this.quit ();});
|
||||||
@ -106,9 +122,19 @@ namespace Pamac {
|
|||||||
run = app.get_is_remote ();
|
run = app.get_is_remote ();
|
||||||
return run;
|
return run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_HAMBURGER
|
||||||
|
#else
|
||||||
|
protected override void activate () {
|
||||||
|
new ManagerWindow (this);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int main (string[] args) {
|
static int main (string[] args) {
|
||||||
|
// This forces the gtk to show the menu icon instead of the global menu to debug
|
||||||
|
//Gtk.init (ref args);
|
||||||
|
//Gtk.Settings.get_default ().gtk_shell_shows_app_menu = false;
|
||||||
var manager = new Manager ();
|
var manager = new Manager ();
|
||||||
return manager.run (args);
|
return manager.run (args);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
//using GIO
|
//using GIO
|
||||||
|
|
||||||
extern void exit(int exit_code);
|
|
||||||
|
|
||||||
const string VERSION = Constants.VERSION;
|
const string VERSION = Constants.VERSION;
|
||||||
|
|
||||||
namespace Pamac {
|
namespace Pamac {
|
||||||
@ -59,17 +57,13 @@ namespace Pamac {
|
|||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.Button button_back;
|
Gtk.Button button_back;
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.HeaderBar headerbar;
|
|
||||||
[GtkChild]
|
|
||||||
Gtk.MenuButton button_menu_global;
|
|
||||||
[GtkChild]
|
|
||||||
Gtk.MenuButton button_menu;
|
Gtk.MenuButton button_menu;
|
||||||
#if ENABLE_HAMBURGER
|
#if ENABLE_HAMBURGER
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.ModelButton preferences_button;
|
Gtk.ModelButton preferences_button;
|
||||||
#else
|
#else
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.ModelButton preferences_button_global;
|
Gtk.HeaderBar headerbar;
|
||||||
#endif
|
#endif
|
||||||
[GtkChild]
|
[GtkChild]
|
||||||
Gtk.TreeView packages_treeview;
|
Gtk.TreeView packages_treeview;
|
||||||
@ -180,14 +174,32 @@ namespace Pamac {
|
|||||||
uint search_entry_timeout_id;
|
uint search_entry_timeout_id;
|
||||||
|
|
||||||
public ManagerWindow (Gtk.Application application) {
|
public ManagerWindow (Gtk.Application application) {
|
||||||
Object (application: application);
|
Object (application: application, title: "Pamac");
|
||||||
|
|
||||||
#if ENABLE_HAMBURGER
|
#if ENABLE_HAMBURGER
|
||||||
headerbar.remove(button_menu_global);
|
|
||||||
button_menu.toggled.connect (on_menu_button_toggled);
|
button_menu.toggled.connect (on_menu_button_toggled);
|
||||||
#else
|
#else
|
||||||
headerbar.remove(button_menu);
|
headerbar.remove(button_menu);
|
||||||
button_menu_global.toggled.connect (on_menu_button_toggled);
|
// connect the menu
|
||||||
|
var action = new SimpleAction ("refreshdb", null);
|
||||||
|
action.activate.connect (on_refresh_button_clicked);
|
||||||
|
this.add_action (action);
|
||||||
|
|
||||||
|
action = new SimpleAction ("viewhistory", null);
|
||||||
|
action.activate.connect (on_history_button_clicked);
|
||||||
|
this.add_action (action);
|
||||||
|
|
||||||
|
action = new SimpleAction ("installlocal", null);
|
||||||
|
action.activate.connect (on_local_button_clicked);
|
||||||
|
this.add_action (action);
|
||||||
|
|
||||||
|
action = new SimpleAction ("preferences", null);
|
||||||
|
action.activate.connect (on_preferences_button_clicked);
|
||||||
|
this.add_action (action);
|
||||||
|
|
||||||
|
action = new SimpleAction ("about", null);
|
||||||
|
action.activate.connect (on_about_button_clicked);
|
||||||
|
this.add_action (action);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DISABLE_AUR
|
#if DISABLE_AUR
|
||||||
@ -209,10 +221,10 @@ namespace Pamac {
|
|||||||
|
|
||||||
this.title = dgettext (null, "Package Manager");
|
this.title = dgettext (null, "Package Manager");
|
||||||
updated_label.set_markup ("<b>%s</b>".printf (dgettext (null, "Your system is up-to-date")));
|
updated_label.set_markup ("<b>%s</b>".printf (dgettext (null, "Your system is up-to-date")));
|
||||||
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
|
|
||||||
while (Gtk.events_pending ()) {
|
while (Gtk.events_pending ()) {
|
||||||
Gtk.main_iteration ();
|
Gtk.main_iteration ();
|
||||||
}
|
}
|
||||||
|
|
||||||
right_click_menu = new Gtk.Menu ();
|
right_click_menu = new Gtk.Menu ();
|
||||||
deselect_item = new Gtk.MenuItem.with_label (dgettext (null, "Deselect"));
|
deselect_item = new Gtk.MenuItem.with_label (dgettext (null, "Deselect"));
|
||||||
deselect_item.activate.connect (on_deselect_item_activate);
|
deselect_item.activate.connect (on_deselect_item_activate);
|
||||||
@ -499,7 +511,6 @@ namespace Pamac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void show_default_pkgs () {
|
public void show_default_pkgs () {
|
||||||
this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH));
|
|
||||||
transaction.get_installed_pkgs.begin ((obj, res) => {
|
transaction.get_installed_pkgs.begin ((obj, res) => {
|
||||||
populate_packages_list (transaction.get_installed_pkgs.end (res));
|
populate_packages_list (transaction.get_installed_pkgs.end (res));
|
||||||
});
|
});
|
||||||
@ -1868,8 +1879,6 @@ namespace Pamac {
|
|||||||
void on_menu_button_toggled () {
|
void on_menu_button_toggled () {
|
||||||
#if ENABLE_HAMBURGER
|
#if ENABLE_HAMBURGER
|
||||||
preferences_button.sensitive = !(transaction_running || sysupgrade_running);
|
preferences_button.sensitive = !(transaction_running || sysupgrade_running);
|
||||||
#else
|
|
||||||
preferences_button_global.sensitive = !(transaction_running || sysupgrade_running);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1975,16 +1984,6 @@ namespace Pamac {
|
|||||||
"website", "http://github.com/cromnix/pamac-classic");
|
"website", "http://github.com/cromnix/pamac-classic");
|
||||||
}
|
}
|
||||||
|
|
||||||
[GtkCallback]
|
|
||||||
void on_quit_button_clicked () {
|
|
||||||
//Gtk.main_quit ();
|
|
||||||
this.quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit() {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[GtkCallback]
|
[GtkCallback]
|
||||||
void on_details_button_clicked () {
|
void on_details_button_clicked () {
|
||||||
important_details = false;
|
important_details = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user