Skip to content

Commit

Permalink
Show gtk version in cli and in About window
Browse files Browse the repository at this point in the history
This change adds the possibility to show the used gtk version either
via `xournalpp --version` or directly in the **About** window.
  • Loading branch information
idotobi committed May 11, 2020
1 parent cc9cdd0 commit 88c10ca
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ assignees: ''
**Affects versions :**
- OS: [e.g. Linux (which distro), Mac, Windows]
- (Linux only) Desktop environment: [e.g. Wayland, Gnome-Wayland, XWayland, X11]
- Which version of libgtk do you use: [e.g. output of `pkg-config --modversion gtk+-3.0`]
- Which version of libgtk do you use
- can be obtained by running `xournalpp --version` or in the **About** window
- Version of Xournal++: [e.g. 1.0.16, specific commit, specific branch]
- can be obtained by running `xournalpp --version` or in the **About** window
- Installation method: [e.g. PPA, Flatpak, official release, etc.]

**Describe the bug**
Expand Down
1 change: 1 addition & 0 deletions src/control/XournalMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ auto XournalMain::run(int argc, char* argv[]) -> int {

if (showVersion) {
g_printf("%s %s \n", PROJECT_NAME, PROJECT_VERSION);
g_printf("└──%s: %d.%d.%d \n", "libgtk", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());
return 0;
}

Expand Down
7 changes: 7 additions & 0 deletions src/gui/dialog/AboutDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "AboutDialog.h"

#include <gtk/gtk.h>

#include <config.h>

#include "StringUtils.h"
Expand All @@ -9,6 +11,11 @@ AboutDialog::AboutDialog(GladeSearchpath* gladeSearchPath): GladeGui(gladeSearch
gtk_label_set_markup(GTK_LABEL(get("lbVersion")), PROJECT_VERSION);
gtk_label_set_markup(GTK_LABEL(get("lbRevId")), GIT_COMMIT_ID);

char gtkVersion[10];
sprintf(gtkVersion, "%d.%d.%d", gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());

gtk_label_set_markup(GTK_LABEL(get("lbGtkVersion")), gtkVersion);

GtkWidget* w = get("vbox1");
GtkWidget* linkButton = gtk_link_button_new("http://github.com/xournalpp/xournalpp");
gtk_widget_show(linkButton);
Expand Down
27 changes: 26 additions & 1 deletion ui/about.glade
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="aboutDialog">
Expand Down Expand Up @@ -171,6 +171,31 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">with libgtk</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lbGtkVersion">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">X.X.X</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down

0 comments on commit 88c10ca

Please sign in to comment.