[gtk+] GtkInspector: Fix Build on Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkInspector: Fix Build on Windows
- Date: Fri, 16 May 2014 15:50:37 +0000 (UTC)
commit 7ea0e2756af1e6794aa5d916ed94a33eaa46c857
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri May 16 18:02:00 2014 +0800
GtkInspector: Fix Build on Windows
Update visual.c to use Windows themes rather than the stock Raleigh theme,
and avoid hardcoding data paths for Windows (and Mac). As the dlfcn.h
functions are only used when Python is enabled, move its inclusion there[*].
Also ensure that variables are declared on the top of the block.
[*] Python support Windows needs to be investigated, as POSIX signal
handling is used there.
https://bugzilla.gnome.org/show_bug.cgi?id=730236
gtk/inspector/classes-list.c | 3 ++-
gtk/inspector/python-hooks.c | 2 +-
gtk/inspector/visual.c | 32 ++++++++++++++++++++++++++++++--
3 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/gtk/inspector/classes-list.c b/gtk/inspector/classes-list.c
index c4f8d92..a5f716d 100644
--- a/gtk/inspector/classes-list.c
+++ b/gtk/inspector/classes-list.c
@@ -138,10 +138,11 @@ add_clicked (GtkButton *button,
if (*name && !g_hash_table_contains (context, name))
{
GtkTreeIter tree_iter;
+ GtkInspectorClassesListByContext *c;
gtk_style_context_add_class (cl->priv->context, name);
- GtkInspectorClassesListByContext *c = g_new0 (GtkInspectorClassesListByContext, 1);
+ c = g_new0 (GtkInspectorClassesListByContext, 1);
c->enabled = TRUE;
c->style = PANGO_STYLE_ITALIC;
g_hash_table_insert (context, (gpointer)g_strdup (name), c);
diff --git a/gtk/inspector/python-hooks.c b/gtk/inspector/python-hooks.c
index 74d74fa..b8253d2 100644
--- a/gtk/inspector/python-hooks.c
+++ b/gtk/inspector/python-hooks.c
@@ -20,10 +20,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include <dlfcn.h>
#include <signal.h>
#ifdef ENABLE_PYTHON
+# include <dlfcn.h>
# include <Python.h>
# include <pygobject.h>
#endif
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index e16cb9a..0130c39 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -17,6 +17,8 @@
#include "visual.h"
+#include "gtkprivate.h"
+
struct _GtkInspectorVisualPrivate
{
GtkWidget *direction_combo;
@@ -158,6 +160,20 @@ fill_gtk (const gchar *path,
}
}
+static gchar*
+get_data_path (const gchar *subdir)
+{
+ gchar *base_datadir, *full_datadir;
+#if defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
+ base_datadir = _gtk_get_datadir();
+#else
+ base_datadir = g_strdup (GTK_DATADIR);
+#endif
+ full_datadir = g_build_filename (base_datadir, subdir, NULL);
+ g_free (base_datadir);
+ return full_datadir;
+}
+
static void
init_theme (GtkInspectorVisual *vis)
{
@@ -166,11 +182,19 @@ init_theme (GtkInspectorVisual *vis)
gchar *theme, *current_theme, *path;
gint i, pos;
GSettings *settings;
+ gchar *themedir = get_data_path ("themes");
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+#ifdef G_OS_WIN32
+ g_hash_table_add (t, g_strdup ("gtk-win32"));
+#else
g_hash_table_add (t, g_strdup ("Raleigh"));
+#endif
+
+ fill_gtk (themedir, t);
+
+ g_free (themedir);
- fill_gtk (GTK_DATADIR "/themes", t);
path = g_build_filename (g_get_user_data_dir (), "themes", NULL);
fill_gtk (path, t);
g_free (path);
@@ -244,10 +268,14 @@ init_icons (GtkInspectorVisual *vis)
gchar *theme, *current_theme, *path;
gint i, pos;
GSettings *settings;
+ gchar *iconsdir = get_data_path ("icons");
t = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- fill_icons (GTK_DATADIR "/icons", t);
+ fill_icons (iconsdir, t);
+
+ g_free (iconsdir);
+
path = g_build_filename (g_get_user_data_dir (), "icons", NULL);
fill_icons (path, t);
g_free (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]