forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
146adf077e
commit
7ea0e2756a
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user