forked from AuroraMiddleware/gtk
widget-factory: small tweaks
Use our canonical example url in the link button, use the placeholder-text feature for the search entry, and add a runtime switch for the dark theme.
This commit is contained in:
parent
786521d5a8
commit
b0dd7e1cfd
@ -24,19 +24,29 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
dark_toggled (GtkCheckMenuItem *item, gpointer data)
|
||||
{
|
||||
gboolean dark;
|
||||
|
||||
dark = gtk_check_menu_item_get_active (item);
|
||||
g_object_set (gtk_settings_get_default (),
|
||||
"gtk-application-prefer-dark-theme", dark,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *window;
|
||||
GtkWidget *widget;
|
||||
gboolean dark = FALSE;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
if (argc > 1 &&
|
||||
(g_strcmp0 (argv[1], "--dark") == 0))
|
||||
g_object_set (gtk_settings_get_default (),
|
||||
"gtk-application-prefer-dark-theme", TRUE,
|
||||
NULL);
|
||||
if (argc > 1 && (g_strcmp0 (argv[1], "--dark") == 0))
|
||||
dark = TRUE;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_file (builder, "./widget-factory.ui", NULL);
|
||||
@ -44,6 +54,10 @@ main (int argc, char *argv[])
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
widget = (GtkWidget*) gtk_builder_get_object (builder, "darkmenuitem");
|
||||
g_signal_connect (widget, "toggled", G_CALLBACK (dark_toggled), NULL);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), dark);
|
||||
|
||||
g_object_unref (G_OBJECT (builder));
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
@ -189,6 +189,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child type="submenu">
|
||||
<object class="GtkMenu" id="view-menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkCheckMenuItem" id="darkmenuitem">
|
||||
<property name="label">_Dark theme</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -304,7 +319,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="text" translatable="yes">search...</property>
|
||||
<property name="placeholder-text" translatable="yes">search...</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -1018,7 +1033,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="uri">http://www.ubuntu.com</property>
|
||||
<property name="uri">http://www.gtk.org</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user