Enlightenment CVS committal
Author : andreas99
Project : e16
Module : tools
Dir : e16/tools/e16menuedit2/src
Modified Files:
callbacks.c e16menuedit2.c libglade_support.c
libglade_support.h
Log Message:
find files for glade and pixmaps
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/callbacks.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- callbacks.c 6 Oct 2004 18:29:15 -0000 1.17
+++ callbacks.c 2 Nov 2004 17:23:14 -0000 1.18
@@ -35,6 +35,7 @@
#include "treeview.h"
extern char *browser;
+extern char *glade_file;
void bind_toolbar_callbacks (GtkWidget *treeview_menu)
{
@@ -158,9 +159,11 @@
GtkWidget *info_window;
GtkWidget *logo_image;
GladeXML *info_xml;
+ char *pixmap_file;
- info_xml = glade_xml_new (PACKAGE_DATA_DIR"/glade/e16menuedit2.glade",
+ info_xml = glade_xml_new (glade_file,
"info_window", NULL);
+
register_libglade_parent (info_xml, "info_window");
glade_xml_signal_autoconnect (info_xml);
@@ -168,12 +171,14 @@
logo_image = lookup_libglade_widget ("info_window", "logo_image");
+ pixmap_file = searchPixmapFile ("e16menuedit2-icon.png");
gtk_image_set_from_file (GTK_IMAGE (logo_image),
- SYSTEM_PIXMAPS_DIR"/e16menuedit2-icon.png");
+ pixmap_file);
gtk_window_set_icon_from_file (GTK_WINDOW (info_window),
- SYSTEM_PIXMAPS_DIR"/e16menuedit2-icon.png",
+ pixmap_file,
NULL);
+ g_free (pixmap_file);
}
void on_toolbutton_save_clicked (GtkToolButton *toolbutton,
@@ -317,9 +322,11 @@
char key[KEY_LENGTH];
char value[VALUE_LENGTH];
GtkTreeModel* treemodel;
+ char *glade_file;
+ char *pixmap_file;
+
+ properties_xml = glade_xml_new (glade_file, "properties_window", NULL);
- properties_xml = glade_xml_new (PACKAGE_DATA_DIR"/glade/e16menuedit2.glade",
- "properties_window", NULL);
register_libglade_parent (properties_xml, "properties_window");
glade_xml_signal_autoconnect (properties_xml);
@@ -329,8 +336,10 @@
gtk_combo_box_set_active (GTK_COMBO_BOX (comboboxentry1), 0);
+ pixmap_file = searchPixmapFile ("e16menuedit2-icon.png");
gtk_window_set_icon_from_file (GTK_WINDOW (properties_window),
- SYSTEM_PIXMAPS_DIR"/e16menuedit2-icon.png", NULL);
+ pixmap_file, NULL);
+ g_free (pixmap_file);
filename_properties = g_strdup_printf ("%s/%s/properties",
homedir (getuid ()), APP_HOME);
@@ -362,7 +371,7 @@
GtkTreeIter iter;
gboolean valid;
GtkTreeModel* treemodel;
- GtkWidget *properties_window;
+ GtkWidget *properties_window;
filename_properties = g_strdup_printf ("%s/%s/properties",
homedir (getuid ()), APP_HOME);
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/e16menuedit2.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e16menuedit2.c 6 Oct 2004 18:19:13 -0000 1.12
+++ e16menuedit2.c 2 Nov 2004 17:23:14 -0000 1.13
@@ -36,6 +36,7 @@
int librsvg_cmp;
char *browser;
+char *glade_file;
int main (int argc, char *argv[])
{
@@ -48,7 +49,7 @@
char good_version[] = "2.7.1";
char *version;
int i;
-
+ char *pixmap_file;
FILE *fz_properties;
gchar *filename_properties;
char key[KEY_LENGTH];
@@ -66,22 +67,20 @@
{
menu_file[i] = NULL;
}
-
- main_xml = glade_xml_new (PACKAGE_DATA_DIR"/glade/e16menuedit2.glade",
- "main_window", NULL);
+
+ glade_file = searchGladeFile ("e16menuedit2.glade");
+ main_xml = glade_xml_new (glade_file, "main_window", NULL);
register_libglade_parent (main_xml, "main_window");
-
glade_xml_signal_autoconnect (main_xml);
-
main_window = lookup_libglade_widget ("main_window", "main_window");
-
+ pixmap_file = searchPixmapFile ("e16menuedit2-icon.png");
gtk_window_set_icon_from_file (GTK_WINDOW (main_window),
- SYSTEM_PIXMAPS_DIR"/e16menuedit2-icon.png",
- NULL);
+ pixmap_file, NULL);
+ g_free (pixmap_file);
treeview_menu = lookup_libglade_widget ("main_window", "treeview_menu");
create_tree_model (treeview_menu);
@@ -121,6 +120,9 @@
gtk_main ();
+
+ g_free (glade_file);
+
return 0;
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/libglade_support.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- libglade_support.c 2 Aug 2004 19:36:15 -0000 1.1
+++ libglade_support.c 2 Nov 2004 17:23:14 -0000 1.2
@@ -62,3 +62,56 @@
return found_widget;
}
+
+char* searchGladeFile (char *glade_file)
+{
+ gboolean glade_found;
+ struct stat buf;
+ gchar *glade_path;
+
+ glade_path = g_strdup_printf ("%s", glade_file);
+ glade_found = !(stat (glade_path, &buf));
+
+ if (!glade_found)
+ {
+ g_free (glade_path);
+ glade_path = g_strdup_printf ("%s/%s", "..", glade_file);
+ glade_found = !(stat (glade_path, &buf));
+
+ if (!glade_found)
+ {
+ g_free (glade_path);
+ glade_path = g_strdup_printf ("%s/%s/%s", PACKAGE_DATA_DIR, "glade",
+ glade_file);
+ }
+
+ }
+
+ return glade_path;
+}
+
+char* searchPixmapFile (char *pixmap_file)
+{
+ gboolean pixmap_found;
+ struct stat buf;
+ gchar *pixmap_path;
+
+ pixmap_path = g_strdup_printf ("%s/%s", "pixmaps", pixmap_file);
+ pixmap_found = !(stat (pixmap_path, &buf));
+
+ if (!pixmap_found)
+ {
+ g_free (pixmap_path);
+ pixmap_path = g_strdup_printf ("%s/%s", "../pixmaps", pixmap_file);
+ pixmap_found = !(stat (pixmap_path, &buf));
+
+ if (!pixmap_found)
+ {
+ g_free (pixmap_path);
+ pixmap_path = g_strdup_printf ("%s/%s", SYSTEM_PIXMAPS_DIR, pixmap_file);
+ }
+
+ }
+
+ return pixmap_path;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e16/tools/e16menuedit2/src/libglade_support.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- libglade_support.h 2 Aug 2004 19:36:15 -0000 1.1
+++ libglade_support.h 2 Nov 2004 17:23:14 -0000 1.2
@@ -32,9 +32,13 @@
#endif
#include <gtk/gtk.h>
#include <glade/glade.h>
-
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
void register_libglade_parent (GladeXML *glade_xml, const char *parent_name);
GtkWidget *lookup_libglade_widget (const char *parent_name, const char *widget_name);
+char* searchGladeFile (char *glade_file);
+char* searchPixmapFile (char *pixmap_file);
#endif /* _LIBGLADE_SUPPORT_H */
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs