|
|
e9b09d |
From e96f82ce459a6d503f70d6c7b0f762bf0d133edf Mon Sep 17 00:00:00 2001
|
|
|
e9b09d |
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
|
|
e9b09d |
Date: Sat, 1 Aug 2020 15:03:23 +0200
|
|
|
e9b09d |
Subject: [PATCH 14/18] Replace the about GtkDialog with a GtkAboutDialog
|
|
|
e9b09d |
|
|
|
e9b09d |
This reduces the amount of code needed for this feature, and integrates
|
|
|
e9b09d |
better with the rest of the system.
|
|
|
e9b09d |
---
|
|
|
e9b09d |
src/gui/callbacks.c | 46 ++++++--------------
|
|
|
e9b09d |
src/gui/callbacks.h | 4 --
|
|
|
e9b09d |
src/gui/gtk-lshw.ui | 101 --------------------------------------------
|
|
|
e9b09d |
src/gui/stock.c | 2 -
|
|
|
e9b09d |
4 files changed, 12 insertions(+), 141 deletions(-)
|
|
|
e9b09d |
|
|
|
e9b09d |
diff --git a/src/gui/callbacks.c b/src/gui/callbacks.c
|
|
|
e9b09d |
index eec3e5571741..b108777fe11f 100644
|
|
|
e9b09d |
--- a/src/gui/callbacks.c
|
|
|
e9b09d |
+++ b/src/gui/callbacks.c
|
|
|
e9b09d |
@@ -10,7 +10,6 @@
|
|
|
e9b09d |
#include "engine.h"
|
|
|
e9b09d |
#include <string.h>
|
|
|
e9b09d |
|
|
|
e9b09d |
-extern GtkWidget *about;
|
|
|
e9b09d |
extern GtkWidget *mainwindow;
|
|
|
e9b09d |
|
|
|
e9b09d |
static char *id = "@(#) $Id$";
|
|
|
e9b09d |
@@ -42,18 +41,6 @@ on_save_activated (GSimpleAction *action,
|
|
|
e9b09d |
save_as(mainwindow);
|
|
|
e9b09d |
}
|
|
|
e9b09d |
|
|
|
e9b09d |
-G_MODULE_EXPORT
|
|
|
e9b09d |
-void
|
|
|
e9b09d |
-on_about_activated (GSimpleAction *action,
|
|
|
e9b09d |
- GVariant *parameter,
|
|
|
e9b09d |
- gpointer app)
|
|
|
e9b09d |
-{
|
|
|
e9b09d |
- if(GTK_IS_WIDGET(about))
|
|
|
e9b09d |
- {
|
|
|
e9b09d |
- gtk_widget_show(about);
|
|
|
e9b09d |
- }
|
|
|
e9b09d |
-}
|
|
|
e9b09d |
-
|
|
|
e9b09d |
G_MODULE_EXPORT
|
|
|
e9b09d |
void
|
|
|
e9b09d |
on_quit_activated (GSimpleAction *action,
|
|
|
e9b09d |
@@ -65,25 +52,20 @@ on_quit_activated (GSimpleAction *action,
|
|
|
e9b09d |
|
|
|
e9b09d |
G_MODULE_EXPORT
|
|
|
e9b09d |
void
|
|
|
e9b09d |
-on_aboutclose_activate (GtkButton *button,
|
|
|
e9b09d |
-gpointer user_data)
|
|
|
e9b09d |
+on_about_activated (GSimpleAction *action,
|
|
|
e9b09d |
+ GVariant *parameter,
|
|
|
e9b09d |
+ gpointer app)
|
|
|
e9b09d |
{
|
|
|
e9b09d |
- if(GTK_IS_WIDGET(about))
|
|
|
e9b09d |
- {
|
|
|
e9b09d |
- gtk_widget_hide(about);
|
|
|
e9b09d |
- }
|
|
|
e9b09d |
-}
|
|
|
e9b09d |
-
|
|
|
e9b09d |
+ gtk_show_about_dialog(GTK_WINDOW(mainwindow),
|
|
|
e9b09d |
+ "program-name", "GTK+ frontend for lshw",
|
|
|
e9b09d |
+ "website", "https://www.ezix.org/",
|
|
|
e9b09d |
+ "copyright", "© 2004-2011 Lyonel Vincent\n© 2020 Emmanuel Gil Peyrot",
|
|
|
e9b09d |
+ "version", getpackageversion(),
|
|
|
e9b09d |
+ "license-type", GTK_LICENSE_GPL_2_0,
|
|
|
e9b09d |
+ NULL);
|
|
|
e9b09d |
|
|
|
e9b09d |
-G_MODULE_EXPORT
|
|
|
e9b09d |
-void
|
|
|
e9b09d |
-on_version_realize (GtkWidget *widget,
|
|
|
e9b09d |
-gpointer user_data)
|
|
|
e9b09d |
-{
|
|
|
e9b09d |
const char *latest = checkupdates();
|
|
|
e9b09d |
|
|
|
e9b09d |
- gtk_label_set_text(GTK_LABEL(widget), getpackageversion());
|
|
|
e9b09d |
-
|
|
|
e9b09d |
if(latest)
|
|
|
e9b09d |
{
|
|
|
e9b09d |
if(strcmp(latest, getpackageversion()) != 0)
|
|
|
e9b09d |
@@ -100,18 +82,14 @@ gpointer user_data)
|
|
|
e9b09d |
latest);
|
|
|
e9b09d |
|
|
|
e9b09d |
gtk_window_set_title(GTK_WINDOW(dialog), "Update available");
|
|
|
e9b09d |
- /* Destroy the dialog when the user responds to it (e.g. clicks a button) */
|
|
|
e9b09d |
- g_signal_connect_swapped (dialog, "response",
|
|
|
e9b09d |
- G_CALLBACK (gtk_widget_destroy),
|
|
|
e9b09d |
- dialog);
|
|
|
e9b09d |
}
|
|
|
e9b09d |
|
|
|
e9b09d |
- gtk_widget_show(dialog);
|
|
|
e9b09d |
+ gtk_dialog_run(GTK_DIALOG(dialog));
|
|
|
e9b09d |
+ gtk_widget_destroy(dialog);
|
|
|
e9b09d |
}
|
|
|
e9b09d |
}
|
|
|
e9b09d |
}
|
|
|
e9b09d |
|
|
|
e9b09d |
-
|
|
|
e9b09d |
G_MODULE_EXPORT
|
|
|
e9b09d |
void
|
|
|
e9b09d |
on_treeview1_row_activated (GtkTreeView *treeview,
|
|
|
e9b09d |
diff --git a/src/gui/callbacks.h b/src/gui/callbacks.h
|
|
|
e9b09d |
index b9b9141c0eb7..e7636efdcae5 100644
|
|
|
e9b09d |
--- a/src/gui/callbacks.h
|
|
|
e9b09d |
+++ b/src/gui/callbacks.h
|
|
|
e9b09d |
@@ -25,10 +25,6 @@ on_quit_activated (GSimpleAction *action,
|
|
|
e9b09d |
GVariant *parameter,
|
|
|
e9b09d |
gpointer app);
|
|
|
e9b09d |
|
|
|
e9b09d |
-void on_aboutclose_activate (GtkButton * button, gpointer user_data);
|
|
|
e9b09d |
-
|
|
|
e9b09d |
-void on_version_realize (GtkWidget * widget, gpointer user_data);
|
|
|
e9b09d |
-
|
|
|
e9b09d |
void
|
|
|
e9b09d |
on_treeview1_row_activated (GtkTreeView * treeview,
|
|
|
e9b09d |
GtkTreePath * path,
|
|
|
e9b09d |
diff --git a/src/gui/gtk-lshw.ui b/src/gui/gtk-lshw.ui
|
|
|
e9b09d |
index b61bedf501ee..57817fd58b39 100644
|
|
|
e9b09d |
--- a/src/gui/gtk-lshw.ui
|
|
|
e9b09d |
+++ b/src/gui/gtk-lshw.ui
|
|
|
e9b09d |
@@ -1,107 +1,6 @@
|
|
|
e9b09d |
|
|
|
e9b09d |
<interface>
|
|
|
e9b09d |
<requires lib="gtk+" version="3.22"/>
|
|
|
e9b09d |
- <object class="GtkDialog" id="aboutlshw">
|
|
|
e9b09d |
- <property name="can_focus">False</property>
|
|
|
e9b09d |
- <property name="title" translatable="yes">About</property>
|
|
|
e9b09d |
- <property name="resizable">False</property>
|
|
|
e9b09d |
- <property name="window_position">center-on-parent</property>
|
|
|
e9b09d |
- <property name="destroy_with_parent">True</property>
|
|
|
e9b09d |
- <property name="type_hint">dialog</property>
|
|
|
e9b09d |
- <property name="skip_taskbar_hint">True</property>
|
|
|
e9b09d |
- <property name="skip_pager_hint">True</property>
|
|
|
e9b09d |
- <child internal-child="vbox">
|
|
|
e9b09d |
- <object class="GtkBox" id="dialog-vbox1">
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">False</property>
|
|
|
e9b09d |
- <property name="orientation">vertical</property>
|
|
|
e9b09d |
- <child internal-child="action_area">
|
|
|
e9b09d |
- <object class="GtkButtonBox" id="dialog-action_area1">
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">False</property>
|
|
|
e9b09d |
- <property name="layout_style">end</property>
|
|
|
e9b09d |
- <child>
|
|
|
e9b09d |
- <object class="GtkButton" id="closebutton1">
|
|
|
e9b09d |
- <property name="label">gtk-close</property>
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">True</property>
|
|
|
e9b09d |
- <property name="can_default">True</property>
|
|
|
e9b09d |
- <property name="receives_default">False</property>
|
|
|
e9b09d |
- <property name="use_stock">True</property>
|
|
|
e9b09d |
- <signal name="activate" handler="on_aboutclose_activate" swapped="no"/>
|
|
|
e9b09d |
- <signal name="clicked" handler="on_aboutclose_activate" swapped="no"/>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- <packing>
|
|
|
e9b09d |
- <property name="expand">False</property>
|
|
|
e9b09d |
- <property name="fill">True</property>
|
|
|
e9b09d |
- <property name="position">0</property>
|
|
|
e9b09d |
- </packing>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- <packing>
|
|
|
e9b09d |
- <property name="expand">False</property>
|
|
|
e9b09d |
- <property name="fill">True</property>
|
|
|
e9b09d |
- <property name="pack_type">end</property>
|
|
|
e9b09d |
- <property name="position">0</property>
|
|
|
e9b09d |
- </packing>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- <child>
|
|
|
e9b09d |
- <object class="GtkLabel" id="aboutext">
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">False</property>
|
|
|
e9b09d |
- <property name="xpad">20</property>
|
|
|
e9b09d |
- <property name="ypad">20</property>
|
|
|
e9b09d |
- <property name="label" translatable="yes"><big><b>GTK+ front-end for <tt>lshw</tt></b></big>
|
|
|
e9b09d |
-
|
|
|
e9b09d |
-© 2004-2011 Lyonel Vincent
|
|
|
e9b09d |
-<tt>lyonel@ezix.org</tt></property>
|
|
|
e9b09d |
- <property name="use_markup">True</property>
|
|
|
e9b09d |
- <property name="justify">center</property>
|
|
|
e9b09d |
- <property name="mnemonic_widget">closebutton1</property>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- <packing>
|
|
|
e9b09d |
- <property name="expand">False</property>
|
|
|
e9b09d |
- <property name="fill">False</property>
|
|
|
e9b09d |
- <property name="position">1</property>
|
|
|
e9b09d |
- </packing>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- <child>
|
|
|
e9b09d |
- <object class="GtkLinkButton" id="linkbutton1">
|
|
|
e9b09d |
- <property name="label" translatable="yes">http://www.ezix.org/</property>
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">True</property>
|
|
|
e9b09d |
- <property name="receives_default">True</property>
|
|
|
e9b09d |
- <property name="has_tooltip">True</property>
|
|
|
e9b09d |
- <property name="relief">none</property>
|
|
|
e9b09d |
- <property name="uri">http://www.ezix.org/</property>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- <packing>
|
|
|
e9b09d |
- <property name="expand">False</property>
|
|
|
e9b09d |
- <property name="fill">True</property>
|
|
|
e9b09d |
- <property name="position">2</property>
|
|
|
e9b09d |
- </packing>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- <child>
|
|
|
e9b09d |
- <object class="GtkLabel" id="version">
|
|
|
e9b09d |
- <property name="visible">True</property>
|
|
|
e9b09d |
- <property name="can_focus">False</property>
|
|
|
e9b09d |
- <property name="label" translatable="yes">VERSION</property>
|
|
|
e9b09d |
- <property name="justify">center</property>
|
|
|
e9b09d |
- <property name="mnemonic_widget">closebutton1</property>
|
|
|
e9b09d |
- <signal name="realize" handler="on_version_realize" swapped="no"/>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- <packing>
|
|
|
e9b09d |
- <property name="expand">False</property>
|
|
|
e9b09d |
- <property name="fill">False</property>
|
|
|
e9b09d |
- <property name="position">3</property>
|
|
|
e9b09d |
- </packing>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
- </child>
|
|
|
e9b09d |
- <action-widgets>
|
|
|
e9b09d |
- <action-widget response="-7">closebutton1</action-widget>
|
|
|
e9b09d |
- </action-widgets>
|
|
|
e9b09d |
- </object>
|
|
|
e9b09d |
<object class="GtkApplicationWindow" id="mainwindow">
|
|
|
e9b09d |
<property name="can_focus">False</property>
|
|
|
e9b09d |
<property name="title" translatable="yes">lshw</property>
|
|
|
e9b09d |
diff --git a/src/gui/stock.c b/src/gui/stock.c
|
|
|
e9b09d |
index 7b98c642d43f..db2e98189662 100644
|
|
|
e9b09d |
--- a/src/gui/stock.c
|
|
|
e9b09d |
+++ b/src/gui/stock.c
|
|
|
e9b09d |
@@ -9,7 +9,6 @@ static char *id = "@(#) $Id$";
|
|
|
e9b09d |
#define UIFILE "gtk-lshw.ui"
|
|
|
e9b09d |
|
|
|
e9b09d |
GtkWidget *mainwindow = NULL;
|
|
|
e9b09d |
-GtkWidget *about = NULL;
|
|
|
e9b09d |
GtkWidget *list1 = NULL;
|
|
|
e9b09d |
GtkWidget *list2 = NULL;
|
|
|
e9b09d |
GtkWidget *list3 = NULL;
|
|
|
e9b09d |
@@ -146,7 +145,6 @@ void lshw_ui_init(GtkApplication *app)
|
|
|
e9b09d |
g_free(uiname);
|
|
|
e9b09d |
|
|
|
e9b09d |
mainwindow = GTK_WIDGET( gtk_builder_get_object( builder, "mainwindow" ) );
|
|
|
e9b09d |
- about = GTK_WIDGET( gtk_builder_get_object( builder, "aboutlshw" ) );
|
|
|
e9b09d |
list1 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview1"));
|
|
|
e9b09d |
list2 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview2"));
|
|
|
e9b09d |
list3 = GTK_WIDGET(gtk_builder_get_object( builder, "treeview3"));
|
|
|
e9b09d |
--
|
|
|
e9b09d |
2.17.1
|
|
|
e9b09d |
|