summaryrefslogtreecommitdiff
path: root/geyes
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-05-27 12:06:02 +0200
committerraveit65 <[email protected]>2020-07-11 17:42:31 +0200
commit31375efa710b751f4a64fab47309d6e35560befb (patch)
treec6b430fb090f507eb39108e848aa9105f30bdec0 /geyes
parent6074e92751f5958c99c2a8f96283a977e20dbb0d (diff)
downloadmate-applets-31375efa710b751f4a64fab47309d6e35560befb.tar.bz2
mate-applets-31375efa710b751f4a64fab47309d6e35560befb.tar.xz
geyes: Add themes.ui
Diffstat (limited to 'geyes')
-rw-r--r--geyes/Makefile.am45
-rw-r--r--geyes/geyes-resources.gresource.xml6
-rw-r--r--geyes/themes.c108
-rw-r--r--geyes/themes.ui171
4 files changed, 229 insertions, 101 deletions
diff --git a/geyes/Makefile.am b/geyes/Makefile.am
index e3c43bcd..514eee30 100644
--- a/geyes/Makefile.am
+++ b/geyes/Makefile.am
@@ -1,3 +1,5 @@
+NULL =
+
SUBDIRS = themes docs
AM_CPPFLAGS = \
@@ -11,15 +13,24 @@ AM_CPPFLAGS = \
libexec_PROGRAMS = mate-geyes-applet
+BUILT_SOURCES = geyes-resources.c geyes-resources.h
+nodist_mate_geyes_applet_SOURCES = $(BUILT_SOURCES)
mate_geyes_applet_SOURCES = \
- geyes.c \
- themes.c \
- geyes.h
+ geyes.c \
+ geyes.h \
+ themes.c \
+ $(NULL)
-mate_geyes_applet_LDADD = \
- $(MATE_APPLETS4_LIBS) \
+mate_geyes_applet_LDADD = \
+ $(MATE_APPLETS4_LIBS) \
-lm
+geyes-resources.c: geyes-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/geyes-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name eyes $<
+
+geyes-resources.h: geyes-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/geyes-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name eyes $<
+
appletdir = $(datadir)/mate-panel/applets
applet_in_files = org.mate.applets.GeyesApplet.mate-panel-applet.desktop.in
applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet)
@@ -60,15 +71,25 @@ icons = \
mate-eyes-applet.22.png \
mate-eyes-applet.16.png
-CLEANFILES = $(applet_DATA) $(applet_in_files) $(service_DATA) $(gsettings_SCHEMAS) *.gschema.valid
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ $(applet_DATA) \
+ $(applet_in_files) \
+ $(service_DATA) \
+ $(gsettings_SCHEMAS) \
+ *.gschema.valid \
+ $(NULL)
EXTRA_DIST = \
- README.themes \
- $(applet_in_files).in \
- $(service_in_files) \
- $(geyes_gschema_in_files) \
- $(ui_DATA) \
- $(icons)
+ geyes-resources.gresource.xml \
+ themes.ui \
+ README.themes \
+ $(applet_in_files).in \
+ $(service_in_files) \
+ $(geyes_gschema_in_files) \
+ $(ui_DATA) \
+ $(icons) \
+ $(NULL)
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
diff --git a/geyes/geyes-resources.gresource.xml b/geyes/geyes-resources.gresource.xml
new file mode 100644
index 00000000..35ba69aa
--- /dev/null
+++ b/geyes/geyes-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/eyes">
+ <file compressed="true">themes.ui</file>
+ </gresource>
+</gresources>
diff --git a/geyes/themes.c b/geyes/themes.c
index 74878315..8a3dee59 100644
--- a/geyes/themes.c
+++ b/geyes/themes.c
@@ -26,8 +26,9 @@
#include <gio/gio.h>
#include "geyes.h"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+
#define NUM_THEME_DIRECTORIES 2
-#define HIG_IDENTATION " "
static char *theme_directories[NUM_THEME_DIRECTORIES];
@@ -249,17 +250,12 @@ void
properties_cb (GtkAction *action,
EyesApplet *eyes_applet)
{
- GtkWidget *pbox, *hbox;
- GtkWidget *vbox, *indent;
- GtkWidget *categories_vbox;
- GtkWidget *category_vbox, *control_vbox;
+ GtkBuilder *builder;
GtkWidget *tree;
- GtkWidget *scrolled;
GtkWidget *label;
GtkListStore *model;
GtkTreeViewColumn *column;
GtkCellRenderer *cell;
- GtkTreeSelection *selection;
GtkTreeIter iter;
DIR *dfd;
struct dirent *dp;
@@ -267,9 +263,8 @@ properties_cb (GtkAction *action,
#ifdef PATH_MAX
gchar filename [PATH_MAX];
#else
- gchar *filename;
+ gchar *filename;
#endif
- gchar *title;
if (eyes_applet->prop_box.pbox) {
gtk_window_set_screen (
@@ -279,88 +274,19 @@ properties_cb (GtkAction *action,
return;
}
- pbox = gtk_dialog_new_with_buttons (_("Eyes Preferences"), NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- "gtk-close", GTK_RESPONSE_CLOSE,
- "gtk-help", GTK_RESPONSE_HELP,
- NULL);
-
- gtk_window_set_screen (GTK_WINDOW (pbox),
- gtk_widget_get_screen (GTK_WIDGET (eyes_applet->applet)));
-
- gtk_widget_set_size_request (GTK_WIDGET (pbox), 300, 200);
- gtk_dialog_set_default_response(GTK_DIALOG (pbox), GTK_RESPONSE_CLOSE);
- gtk_container_set_border_width (GTK_CONTAINER (pbox), 5);
- gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pbox))), 2);
-
- g_signal_connect (pbox, "response",
- G_CALLBACK (presponse_cb),
- eyes_applet);
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- gtk_widget_show (vbox);
-
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (pbox))), vbox,
- TRUE, TRUE, 0);
-
- categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
- gtk_box_pack_start (GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0);
- gtk_widget_show (categories_vbox);
-
- category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
- gtk_widget_show (category_vbox);
-
- title = g_strconcat ("<span weight=\"bold\">", _("Themes"), "</span>", NULL);
- label = gtk_label_new (_(title));
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0);
- g_free (title);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- indent = gtk_label_new (HIG_IDENTATION);
- gtk_label_set_justify (GTK_LABEL (indent), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0);
- gtk_widget_show (indent);
-
- control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
- gtk_widget_show (control_vbox);
-
- label = gtk_label_new_with_mnemonic (_("_Select a theme:"));
- gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_box_pack_start (GTK_BOX (control_vbox), label, FALSE, FALSE, 0);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
+ builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/eyes/themes.ui");
- model = gtk_list_store_new (TOTAL_COLS, G_TYPE_STRING, G_TYPE_STRING);
- tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree), FALSE);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), tree);
- g_object_unref (model);
-
- gtk_container_add (GTK_CONTAINER (scrolled), tree);
+ eyes_applet->prop_box.pbox = GET_WIDGET ("preferences_dialog");
+ tree = GET_WIDGET ("themes_treeview");
+ label = GET_WIDGET ("select_theme_label");
+ model = gtk_list_store_new (TOTAL_COLS, G_TYPE_STRING, G_TYPE_STRING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree), GTK_TREE_MODEL (model));
cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("not used", cell,
"text", COL_THEME_NAME, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
- g_signal_connect (selection, "changed",
- G_CALLBACK (theme_selected_cb),
- eyes_applet);
-
if ( ! g_settings_is_writable (eyes_applet->settings, "theme-path")) {
gtk_widget_set_sensitive (tree, FALSE);
gtk_widget_set_sensitive (label, FALSE);
@@ -408,14 +334,18 @@ properties_cb (GtkAction *action,
#ifndef PATH_MAX
g_free (filename);
#endif
+ g_object_unref (model);
- gtk_box_pack_start (GTK_BOX (control_vbox), scrolled, TRUE, TRUE, 0);
+ /* signals */
+ gtk_builder_add_callback_symbols (builder,
+ "on_preferences_dialog_response", G_CALLBACK (presponse_cb),
+ "on_themes_treeselection_changed", G_CALLBACK (theme_selected_cb),
+ NULL);
+ gtk_builder_connect_signals (builder, eyes_applet);
- gtk_widget_show_all (pbox);
+ g_object_unref (builder);
- eyes_applet->prop_box.pbox = pbox;
+ gtk_widget_show_all (eyes_applet->prop_box.pbox);
return;
}
-
-
diff --git a/geyes/themes.ui b/geyes/themes.ui
new file mode 100644
index 00000000..70409f3b
--- /dev/null
+++ b/geyes/themes.ui
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.36.0 -->
+<interface>
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">help-browser</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">window-close</property>
+ </object>
+ <object class="GtkDialog" id="preferences_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Eyes Preferences</property>
+ <property name="default_width">300</property>
+ <property name="default_height">200</property>
+ <property name="icon_name">mate-eyes-applet</property>
+ <property name="type_hint">dialog</property>
+ <signal name="response" handler="on_preferences_dialog_response" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">_Help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ <property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">_Close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ <property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="select_theme_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">_Select a theme:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">themes_treeview</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="themes_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="themes_treeselection">
+ <signal name="changed" handler="on_themes_treeselection_changed" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Themes</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">button1</action-widget>
+ <action-widget response="-7">button2</action-widget>
+ </action-widgets>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ </object>
+</interface>