restarting work on obconf
This commit is contained in:
parent
c4275beff0
commit
a354b0f5a9
5 changed files with 93 additions and 52 deletions
30
Makefile.am
30
Makefile.am
|
@ -5,6 +5,7 @@ localedir = $(datadir)/locale
|
||||||
rcdir = $(datadir)/openbox
|
rcdir = $(datadir)/openbox
|
||||||
plugindir = $(libdir)/openbox/plugins
|
plugindir = $(libdir)/openbox/plugins
|
||||||
desktopfilesdir = $(datadir)/gnome/wm-properties
|
desktopfilesdir = $(datadir)/gnome/wm-properties
|
||||||
|
pixmapdir = $(datadir)/pixmaps
|
||||||
|
|
||||||
theme = operation
|
theme = operation
|
||||||
|
|
||||||
|
@ -34,8 +35,11 @@ plugin_LTLIBRARIES = \
|
||||||
plugins/menu/include_menu.la
|
plugins/menu/include_menu.la
|
||||||
|
|
||||||
if OBCONF
|
if OBCONF
|
||||||
plugin_LTLIBRARIES += \
|
bin_PROGRAMS += \
|
||||||
plugins/resistance/resistance-config.la
|
tools/obconf/obconf
|
||||||
|
|
||||||
|
#plugin_LTLIBRARIES += \
|
||||||
|
# plugins/resistance/resistance-config.la
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## render ##
|
## render ##
|
||||||
|
@ -328,6 +332,28 @@ plugins_menu_include_menu_la_SOURCES = \
|
||||||
plugins/menu/include_menu.c
|
plugins/menu/include_menu.c
|
||||||
|
|
||||||
|
|
||||||
|
## obconf ##
|
||||||
|
|
||||||
|
tools_obconf_obconf_CPPFLAGS = \
|
||||||
|
$(GTK_CFLAGS) \
|
||||||
|
$(GDK_PIXBUF_CFLAGS) \
|
||||||
|
$(XML_CFLAGS) \
|
||||||
|
-DLOCALEDIR=\"$(localedir)\" \
|
||||||
|
-DPLUGINDIR=\"$(plugindir)\" \
|
||||||
|
-DRCDIR=\"$(rcdir)\" \
|
||||||
|
-DPIXMAPDIR=\"$(pixmapdir)\" \
|
||||||
|
-DG_LOG_DOMAIN=\"Obconf\"
|
||||||
|
tools_obconf_obconf_LDADD = \
|
||||||
|
$(GTK_LIBS) \
|
||||||
|
$(GDK_PIXBUF_LIBS) \
|
||||||
|
$(LIBINTL) \
|
||||||
|
render/libobrender.la \
|
||||||
|
parser/libobparser.la
|
||||||
|
tools_obconf_obconf_SOURCES = \
|
||||||
|
gettext.h \
|
||||||
|
tools/obconf/main.c
|
||||||
|
|
||||||
|
|
||||||
## themes ##
|
## themes ##
|
||||||
|
|
||||||
dist_theme_DATA = \
|
dist_theme_DATA = \
|
||||||
|
|
14
configure.ac
14
configure.ac
|
@ -67,14 +67,14 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
|
||||||
AC_SUBST(GTK_LIBS)
|
AC_SUBST(GTK_LIBS)
|
||||||
use_gtk="yes"
|
use_gtk="yes"
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GLADE, [libglade-2.0],
|
PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0],
|
||||||
[
|
[
|
||||||
AC_SUBST(GLADE_CFLAGS)
|
AC_SUBST(GDK_PIXBUF_CFLAGS)
|
||||||
AC_SUBST(GLADE_LIBS)
|
AC_SUBST(GDK_PIXBUF_LIBS)
|
||||||
use_glade="yes"
|
use_gdk_pixbuf="yes"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
use_glade="no"
|
use_gdk_pixbuf="no"
|
||||||
AC_MSG_WARN([disabling build of the configuration tool])
|
AC_MSG_WARN([disabling build of the configuration tool])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -84,8 +84,8 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
|
||||||
AC_MSG_WARN([disabling build of the configuration tool])
|
AC_MSG_WARN([disabling build of the configuration tool])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
#AM_CONDITIONAL(OBCONF, [test "$use_gtk" = "yes" && test "$use_glade" = "yes"])
|
AM_CONDITIONAL(OBCONF,
|
||||||
AM_CONDITIONAL(OBCONF, [false])
|
[test "$use_gtk" = "yes" && test "$use_gdk_pixbuf" = "yes"])
|
||||||
|
|
||||||
# Check for session management
|
# Check for session management
|
||||||
X11_SM
|
X11_SM
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
obconf
|
obconf
|
||||||
|
.dirstamp
|
||||||
|
|
4
tools/obconf/Makefile
Normal file
4
tools/obconf/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
all clean install:
|
||||||
|
$(MAKE) -C ../.. -$(MAKEFLAGS) $@
|
||||||
|
|
||||||
|
.PHONY: all clean install
|
|
@ -1,59 +1,69 @@
|
||||||
#include "kernel/debug.h"
|
|
||||||
#include "obconf.h"
|
#include "obconf.h"
|
||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "parser/parse.h"
|
#include "parser/parse.h"
|
||||||
|
#include "gettext.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <glade/glade.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
/*#include <X11/Xlib.h>
|
#define OB_ICON "openbox-icon"
|
||||||
Display *ob_display;
|
|
||||||
int ob_screen;
|
|
||||||
Window ob_root;*/
|
|
||||||
|
|
||||||
GtkWindow *obconf_win;
|
static GtkWidget *mainwin;
|
||||||
GtkWindow *obconf_about = NULL;
|
static GdkPixbuf *ob_icon;
|
||||||
|
|
||||||
GtkTreeView *obconf_sections;
|
static void obconf_error(GError *e)
|
||||||
GtkListStore *obconf_sections_store;
|
{
|
||||||
static GtkCellRenderer *obconf_sections_renderer;
|
GtkWidget *d;
|
||||||
static GtkTreeViewColumn *obconf_sections_column;
|
|
||||||
|
|
||||||
GtkNotebook *obconf_options;
|
d = gtk_message_dialog_new(mainwin ? GTK_WINDOW(mainwin) : NULL,
|
||||||
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
GTK_MESSAGE_ERROR,
|
||||||
|
GTK_BUTTONS_CLOSE,
|
||||||
|
"%s", e->message);
|
||||||
|
gtk_dialog_run(GTK_DIALOG(d));
|
||||||
|
gtk_widget_destroy(d);
|
||||||
|
}
|
||||||
|
|
||||||
static xmlDocPtr doc;
|
static void load_stock ()
|
||||||
static xmlNodePtr root;
|
{
|
||||||
|
GtkIconFactory *factory;
|
||||||
|
GError *e = NULL;
|
||||||
|
|
||||||
|
gtk_icon_factory_add_default (factory = gtk_icon_factory_new ());
|
||||||
|
|
||||||
|
ob_icon = gdk_pixbuf_new_from_file (PIXMAPDIR G_DIR_SEPARATOR_S
|
||||||
|
"openbox.png", &e);
|
||||||
|
if (!ob_icon) {
|
||||||
|
gchar *msg = g_strdup_printf
|
||||||
|
(_("Failed to load the Openbox icon, Openbox is probably not "
|
||||||
|
"installed correctly. The error given was '%s'."),
|
||||||
|
e->message);
|
||||||
|
g_free (e->message);
|
||||||
|
e->message = msg;
|
||||||
|
obconf_error (e);
|
||||||
|
} else {
|
||||||
|
GtkIconSet *set;
|
||||||
|
|
||||||
|
set = gtk_icon_set_new_from_pixbuf (ob_icon);
|
||||||
|
gtk_icon_factory_add (factory, OB_ICON, set);
|
||||||
|
gtk_icon_set_unref (set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
GladeXML *xml;
|
gtk_set_locale();
|
||||||
|
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
xml = glade_xml_new("obconf.glade", NULL, NULL);
|
load_stock();
|
||||||
glade_xml_signal_autoconnect(xml);
|
|
||||||
|
|
||||||
obconf_win = GTK_WINDOW(glade_xml_get_widget(xml, "mainwindow"));
|
mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gtk_window_set_role(obconf_win, "main");
|
gtk_window_set_title(GTK_WINDOW(mainwin), "Obconf");
|
||||||
obconf_about = GTK_WINDOW(glade_xml_get_widget(xml, "aboutdialog"));
|
gtk_window_set_wmclass(GTK_WINDOW(mainwin), "obconf", "Obconf");
|
||||||
gtk_window_set_role(obconf_about, "about");
|
gtk_window_set_role(GTK_WINDOW(mainwin), "main window");
|
||||||
gtk_window_set_transient_for(obconf_about, obconf_win);
|
if (ob_icon) gtk_window_set_icon(GTK_WINDOW(mainwin), ob_icon);
|
||||||
obconf_sections = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sectiontree"));
|
|
||||||
obconf_options = GTK_NOTEBOOK(glade_xml_get_widget(xml,"optionsnotebook"));
|
|
||||||
|
|
||||||
obconf_sections_store = gtk_list_store_new(1, G_TYPE_STRING);
|
gtk_widget_show_all(mainwin);
|
||||||
gtk_tree_view_set_model(obconf_sections,
|
|
||||||
GTK_TREE_MODEL(obconf_sections_store));
|
|
||||||
obconf_sections_renderer = gtk_cell_renderer_text_new();
|
|
||||||
obconf_sections_column = gtk_tree_view_column_new_with_attributes
|
|
||||||
("Section", obconf_sections_renderer, "text", 0, NULL);
|
|
||||||
gtk_tree_view_append_column (obconf_sections, obconf_sections_column);
|
|
||||||
|
|
||||||
parse_load_rc(&doc, &root);
|
|
||||||
|
|
||||||
plugins_load();
|
|
||||||
|
|
||||||
gtk_widget_show(GTK_WIDGET(obconf_win));
|
|
||||||
|
|
||||||
gtk_main();
|
gtk_main();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -72,21 +82,21 @@ void on_quit_activate(GtkMenuItem *item, gpointer d)
|
||||||
|
|
||||||
void on_applybutton_clicked(GtkButton *but, gpointer d)
|
void on_applybutton_clicked(GtkButton *but, gpointer d)
|
||||||
{
|
{
|
||||||
ob_debug("apply\n");
|
g_message("apply\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_revertbutton_clicked(GtkButton *but, gpointer d)
|
void on_revertbutton_clicked(GtkButton *but, gpointer d)
|
||||||
{
|
{
|
||||||
ob_debug("revert\n");
|
g_message("revert\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_helpbutton_clicked(GtkButton *but, gpointer d)
|
void on_helpbutton_clicked(GtkButton *but, gpointer d)
|
||||||
{
|
{
|
||||||
ob_debug("help\n");
|
g_message("help\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path,
|
void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path,
|
||||||
GtkTreeViewColumn *col, gpointer p)
|
GtkTreeViewColumn *col, gpointer p)
|
||||||
{
|
{
|
||||||
ob_debug("activated\n");
|
g_message("activated\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue