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