diff options
author | Leandro Pereira <leandro@linuxmag.com.br> | 2004-06-14 21:33:25 -0300 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:31 -0500 |
commit | 7d65a12d6431f72e601ea1d0c3ef5d09af8bfb96 (patch) | |
tree | 7ad1761adce3212a13e5342a54865e31b917f18b /about.c | |
parent | 0864b0a8e6f0b0983c3536931cfbad1414137d6b (diff) | |
parent | 8c1612d32c5682a86216adb8c8d11ce715fe5475 (diff) |
Import Debian changes 0.3.6-5
hardinfo (0.3.6-5) unstable; urgency=high
* Add Amd64 support (closes: #253935).
Thanks to Kurt Roeckx <Q@ping.be>
* Close duplicate "doesn't work with newer pciutils" bug (closes: #254018).
hardinfo (0.3.6-4) unstable; urgency=high
* Fixed segfault on startup (closes: #242843).
Thanks to Remco van de Meent <remco@debian.org>
hardinfo (0.3.6-3) unstable; urgency=high
* Added Debian menu entry icon.
* Fixed some misc packaging bugs.
* Changed package description.
hardinfo (0.3.6-2) unstable; urgency=low
* Sync with upstream sources.
* Disabled "Network" tab.
hardinfo (0.3.6-1) unstable; urgency=high
* Sync with upstream sources.
hardinfo (0.3.5-1) unstable; urgency=high
* Sync with upstream sources.
hardinfo (0.3.4-1) unstable; urgency=high
* Sync with upstream sources.
hardinfo (0.3.3-1) unstable; urgency=low
* Sync with upstream sources.
hardinfo (0.3.2-1) unstable; urgency=low
* Sync with upstream sources.
hardinfo (0.3.1-1) unstable; urgency=low
* Sync with upstream sources.
hardinfo (0.3-1) unstable; urgency=low
* Initial Release.
Diffstat (limited to 'about.c')
-rw-r--r-- | about.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/about.c b/about.c new file mode 100644 index 00000000..0d7fae0e --- /dev/null +++ b/about.c @@ -0,0 +1,120 @@ +#include "hardinfo.h" +#include "about.h" + +static void about_close(GtkWidget *widget, gpointer data) +{ + GtkAbout *about = (GtkAbout*) data; + + gtk_widget_destroy(about->window); +} + +GtkAbout * +gtk_about_new(const gchar * name, const gchar * version, + const gchar * description, const gchar * authors[], const gchar * logo_img) +{ +#ifdef GTK2 + GtkWidget *img; +#endif + gchar *buf; + const gchar *auth; + GtkWidget *window, *vbox, *label, *btn, *hr, *hbox; + GtkAbout *about; + gint i; + + about = g_new0(GtkAbout, 1); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "About"); + gtk_container_set_border_width(GTK_CONTAINER(window), 8); + + about->window = window; + +#ifdef GTK2 + gtk_window_set_resizable(GTK_WINDOW(window), FALSE); +#else + gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); +#endif + + vbox = gtk_vbox_new(FALSE, 5); + gtk_box_set_spacing(GTK_BOX(vbox), 3); + gtk_container_add(GTK_CONTAINER(window), vbox); + +#ifdef GTK2 + img = gtk_image_new_from_file(logo_img); + gtk_widget_show(img); + gtk_box_pack_start(GTK_BOX(vbox), img, FALSE, FALSE, 0); + gtk_widget_set_usize(GTK_WIDGET(img), 64, 64); +#endif + +#ifdef GTK2 +#define ADD_LABEL(x,y) label = gtk_label_new(x); \ + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \ + gtk_widget_show(label); \ + gtk_box_pack_start(GTK_BOX(y), label, TRUE, TRUE, 0); +#else +#define ADD_LABEL(x,y) label = gtk_label_new(x); \ + gtk_widget_show(label); \ + gtk_box_pack_start(GTK_BOX(y), label, TRUE, TRUE, 0); +#endif + +#ifdef GTK2 + buf = + g_strdup_printf + ("<span size=\"xx-large\" weight=\"bold\">%s %s</span>", name, + version); +#else + buf = g_strdup_printf("%s %s", name, version); +#endif + ADD_LABEL(buf, vbox); + g_free(buf); + + ADD_LABEL(description, vbox); + + for (i = 0; authors[i] != NULL; i++) { + auth = authors[i]; + + if (*auth == '>') { + auth++; + +#ifdef GTK2 + buf = g_strdup_printf("<b>%s</b>", auth); +#else + buf = g_strdup_printf("%s", auth); +#endif + ADD_LABEL(buf, vbox); + g_free(buf); + } else { +#ifdef GTK2 + buf = g_strdup_printf("<span size=\"small\">%s</span>", auth); +#else + buf = g_strdup_printf(" %s", auth); +#endif + ADD_LABEL(buf, vbox); + g_free(buf); + } + } + + hr = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(vbox), hr, FALSE, FALSE, 0); + + hbox = gtk_hbutton_box_new(); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 4); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); + +#ifdef GTK2 + btn = gtk_button_new_from_stock(GTK_STOCK_OK); + g_signal_connect(G_OBJECT(btn), "clicked", (GCallback)about_close, about); +#else + btn = gtk_button_new_with_label(_("OK")); + gtk_signal_connect(GTK_OBJECT(btn), "clicked", about_close, about); +#endif + gtk_widget_show(btn); + gtk_box_pack_start(GTK_BOX(hbox), btn, FALSE, FALSE, 0); + + gtk_widget_show_all(window); + + return about; + +} |