[Rawstudio-commit] r1702 - trunk/src

Anders Brander anders at brander.dk
Thu Apr 3 20:20:00 CEST 2008


Author: abrander
Date: 2008-04-03 20:19:59 +0200 (Thu, 03 Apr 2008)
New Revision: 1702

Modified:
   trunk/src/conf_interface.h
   trunk/src/gtk-interface.c
   trunk/src/rawstudio.c
Log:
Added option for theme-switching.

Modified: trunk/src/conf_interface.h
===================================================================
--- trunk/src/conf_interface.h	2008-04-03 18:19:08 UTC (rev 1701)
+++ trunk/src/conf_interface.h	2008-04-03 18:19:59 UTC (rev 1702)
@@ -53,6 +53,7 @@
 #define CONF_ROI_GRID "roi_grid"
 #define CONF_CROP_ASPECT "crop_aspect"
 #define CONF_SHOW_FILENAMES "show_filenames_in_iconview"
+#define CONF_USE_DARK_THEME "use_dark_theme"
 #define CONF_FULLSCREEN "fullscreen"
 #define CONF_SHOW_TOOLBOX_FULLSCREEN "show_toolbox_fullscreen"
 #define CONF_SHOW_TOOLBOX "show_toolbox"

Modified: trunk/src/gtk-interface.c
===================================================================
--- trunk/src/gtk-interface.c	2008-04-03 18:19:08 UTC (rev 1701)
+++ trunk/src/gtk-interface.c	2008-04-03 18:19:59 UTC (rev 1702)
@@ -398,6 +398,20 @@
 }
 
 static void
+gui_preference_use_dark_theme(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	printf("pik\n");
+	if (togglebutton->active)
+	{
+		gui_select_theme(DARK_THEME);
+	}
+	else
+	{
+		gui_select_theme(STANDARD_GTK_THEME);
+	}
+}
+
+static void
 gui_preference_preload_changed(GtkToggleButton *togglebutton, gpointer user_data)
 {
 	if (togglebutton->active)
@@ -426,6 +440,7 @@
 	GtkObject *histsize_adj;
 	gint histogram_height;
 	GtkWidget *local_cache_check;
+	GtkWidget *dark_theme_check;
 	GtkWidget *load_gdk_check;
 	GtkWidget *preload_check;
 	GtkWidget *show_filenames;
@@ -512,6 +527,11 @@
 	g_signal_connect ((gpointer) show_filenames, "toggled",
 		G_CALLBACK (gui_preference_iconview_show_filenames_changed), rs);
 
+	dark_theme_check = checkbox_from_conf(CONF_USE_DARK_THEME, _("Use dark theme"), TRUE);
+	gtk_box_pack_start (GTK_BOX (preview_page), dark_theme_check, FALSE, TRUE, 0);
+	g_signal_connect ((gpointer) dark_theme_check, "toggled",
+		G_CALLBACK (gui_preference_use_dark_theme), rs);
+
 	gtk_box_pack_start (GTK_BOX (preview_page), gtk_hseparator_new(), FALSE, TRUE, 0);
 
 	local_cache_check = checkbox_from_conf(CONF_CACHEDIR_IS_LOCAL, _("Place cache in home directory"), FALSE);
@@ -780,6 +800,8 @@
 	gtk_drag_dest_set(GTK_WIDGET(rawstudio_window), GTK_DEST_DEFAULT_ALL, targets, 1, GDK_ACTION_COPY);
 	g_signal_connect((gpointer) rawstudio_window, "drag_data_received", G_CALLBACK(drag_data_received), rs);
 
+	gtk_widget_set_name (GTK_WIDGET(rawstudio_window), "rawstudio-widget");
+
 	return(GTK_WIDGET(rawstudio_window));
 }
 

Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c	2008-04-03 18:19:08 UTC (rev 1701)
+++ trunk/src/rawstudio.c	2008-04-03 18:19:59 UTC (rev 1702)
@@ -918,6 +918,7 @@
 	TEST_FILE_ACCESS(PACKAGE_DATA_DIR "/pixmaps/" PACKAGE "/transform_180.png");
 	TEST_FILE_ACCESS(PACKAGE_DATA_DIR "/pixmaps/" PACKAGE "/transform_270.png");
 	TEST_FILE_ACCESS(PACKAGE_DATA_DIR "/" PACKAGE "/ui.xml");
+	TEST_FILE_ACCESS(PACKAGE_DATA_DIR "/" PACKAGE "/dark.gtkrc");
 #undef TEST_FILE_ACCESS
 }
 
@@ -954,6 +955,7 @@
 	RS_BLOB *rs;
 	int optimized = 1;
 	int opt;
+	gboolean use_dark_theme = TRUE;
 
 	while ((opt = getopt(argc, argv, "n")) != -1) {
 		switch (opt) {
@@ -979,6 +981,12 @@
 	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
 	textdomain(GETTEXT_PACKAGE);
 #endif
+
+	/* Switch to dark theme before any drawing if needed */
+	rs_conf_get_boolean_with_default(CONF_USE_DARK_THEME, &use_dark_theme, TRUE);
+	if (use_dark_theme)
+		gui_select_theme(DARK_THEME);
+
 	rs_init_filetypes();
 	gtk_init(&argc, &argv);
 	check_install();




More information about the Rawstudio-commit mailing list