Author: peter
Date: 2006-11-28 21:03:07 +0000 (Tue, 28 Nov 2006)
New Revision: 24005

Modified:
   xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c
   xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h
   xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
   xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
Log:
preferences dialog suport object config



Modified: xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c        
2006-11-28 18:45:10 UTC (rev 24004)
+++ xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.c        
2006-11-28 21:03:07 UTC (rev 24005)
@@ -19,6 +19,7 @@
 #include <config.h>
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 #include <libxarchiver/libxarchiver.h>
 
 #ifdef HAVE_THUNAR_VFS
@@ -36,6 +37,38 @@
 static void
 xa_preferences_dialog_init(XAPreferencesDialog *archive);
 
+static void
+cb_xa_preferences_dialog_item_activated(GtkWidget *widget, GtkTreePath *path, 
gpointer user_data);
+
+static GtkWidget *
+xa_preferences_dialog_create_page(LXAArchiveSupport *support);
+
+static GdkPixbuf *
+create_icon_from_widget(GtkWidget *widget);
+
+static void
+vis_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data);
+static void
+vis_drag_leave(GtkWidget * widget, GdkDragContext *context, GtkSelectionData 
*data, guint info, guint time, gpointer user_data);
+static void
+vis_drag_motion(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data);
+
+static void
+hid_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data);
+
+static void
+button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer 
user_data);
+static void
+button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer 
user_data);
+static void
+data_get(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, 
guint info, guint time, gpointer user_data);
+
+static gboolean
+signal_blocker(GtkWidget *widget, gpointer user_data)
+{
+       return TRUE;
+}
+
 GType
 xa_preferences_dialog_get_type ()
 {
@@ -73,6 +106,7 @@
        GtkWidget *box;
        GtkWidget *label;
        GtkWidget *frame;
+       GtkWidget *iconview;
        dialog->notebook = gtk_notebook_new();
 
        box = gtk_vbox_new(FALSE, 0);
@@ -122,6 +156,49 @@
        label = gtk_label_new_with_mnemonic(_("_Archivers"));
        gtk_notebook_append_page(GTK_NOTEBOOK(dialog->notebook), box, label);
 
+       GtkTreeModel *store = GTK_TREE_MODEL(gtk_list_store_new(2, 
GDK_TYPE_PIXBUF, G_TYPE_STRING));
+       GtkCellRenderer *render = gtk_cell_renderer_pixbuf_new();
+
+       iconview = gtk_icon_view_new_with_model(store);
+       g_signal_connect(G_OBJECT(iconview), "item-activated", 
(GCallback)cb_xa_preferences_dialog_item_activated, dialog);
+
+       GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL);
+       gtk_widget_set_size_request(scroll, 84, 84);
+
+       gtk_container_add(GTK_CONTAINER(scroll), iconview);
+       /* gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), 
iconview); */
+       gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), 
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+       gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(scroll), 
GTK_CORNER_TOP_RIGHT);
+       gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), 
GTK_SHADOW_IN);
+
+       render = gtk_cell_renderer_text_new();
+       gtk_icon_view_set_item_width(GTK_ICON_VIEW(iconview), 48);
+       gtk_icon_view_set_orientation(GTK_ICON_VIEW(iconview), 
GTK_ORIENTATION_VERTICAL);
+       gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(iconview), 0);
+       gtk_icon_view_set_text_column(GTK_ICON_VIEW(iconview), 1);
+
+       /* TODO: auto gen this here */
+
+       GtkTreeIter iter;
+       gtk_list_store_append(GTK_LIST_STORE(store), &iter);
+       gtk_list_store_set(GTK_LIST_STORE(store), &iter, 1, "zip", -1);
+       gtk_list_store_append(GTK_LIST_STORE(store), &iter);
+       gtk_list_store_set(GTK_LIST_STORE(store), &iter, 1, "tar", -1);
+       gtk_list_store_append(GTK_LIST_STORE(store), &iter);
+       gtk_list_store_set(GTK_LIST_STORE(store), &iter, 1, "ehmm", -1);
+
+       gtk_widget_show(iconview);
+
+       dialog->support.notebook = gtk_notebook_new();
+       gtk_notebook_set_show_tabs(GTK_NOTEBOOK(dialog->support.notebook), 
FALSE);
+       gtk_notebook_set_show_border(GTK_NOTEBOOK(dialog->support.notebook), 
FALSE);
+
+       gtk_notebook_append_page(GTK_NOTEBOOK(dialog->support.notebook), 
xa_preferences_dialog_create_page(NULL), NULL);
+
+       gtk_box_pack_start(GTK_BOX(box), scroll, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(box), dialog->support.notebook, TRUE, TRUE, 
0);
+       gtk_widget_show_all(box);
+
        box = gtk_hbox_new(FALSE, 0);
        label = gtk_label_new_with_mnemonic(_("_Behaviour"));
        gtk_notebook_append_page(GTK_NOTEBOOK(dialog->notebook), box, label);
@@ -145,3 +222,157 @@
 
        return dialog;
 }
+
+static GtkWidget *
+xa_preferences_dialog_create_page(LXAArchiveSupport *support)
+{
+       GtkTargetEntry entry;
+
+       GtkWidget *_vbox = gtk_vbox_new(FALSE, 0);
+
+       GtkWidget *vbox = gtk_vbox_new(TRUE, 0);
+
+       GtkWidget *visbox = gtk_hbox_new(FALSE, 0);
+       GtkWidget *hidbox = gtk_hbox_new(FALSE, 0);
+
+       GtkWidget *frame = gtk_frame_new(_("Visible:"));
+
+       GtkWidget *button = gtk_button_new_with_label(_("Filename"));
+
+       entry.target = "_XA_PREF_DIALOG_BUTTON";
+       entry.flags = GTK_TARGET_SAME_APP;
+       entry.info = 2;
+
+       gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &entry, 1, 
GDK_ACTION_MOVE);
+
+       g_signal_connect(frame, "drag_data_received", 
G_CALLBACK(vis_data_received), visbox);
+       g_signal_connect(frame, "drag_motion", G_CALLBACK(vis_drag_motion), 
visbox);
+       g_signal_connect(frame, "drag_leave", G_CALLBACK(vis_drag_leave), 
visbox);
+
+       gtk_container_add(GTK_CONTAINER(frame), visbox);
+
+       gtk_box_pack_start(GTK_BOX(visbox), button, FALSE, FALSE, 0);
+       g_signal_connect(G_OBJECT(button), "button_press_event", 
G_CALLBACK(signal_blocker), NULL);
+       g_signal_connect(G_OBJECT(button), "enter_notify_event", 
G_CALLBACK(signal_blocker), NULL);
+       g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(signal_blocker), 
NULL);
+
+       gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0);
+
+       frame = gtk_frame_new(_("Availble:"));
+
+       gtk_drag_dest_set(frame, GTK_DEST_DEFAULT_ALL, &entry, 1, 
GDK_ACTION_MOVE);
+
+       g_signal_connect(frame, "drag_data_received", 
G_CALLBACK(hid_data_received), hidbox);
+
+       gtk_container_add(GTK_CONTAINER(frame), hidbox);
+
+/*for cols*/
+
+       button = gtk_button_new_with_label("size");
+
+       gtk_box_pack_start(GTK_BOX(visbox), button, FALSE, FALSE, 0);
+       
+       gtk_drag_source_set(button, GDK_BUTTON1_MASK, &entry, 1, 
GDK_ACTION_MOVE);
+
+       g_signal_connect(G_OBJECT(button), "drag-data-get", 
G_CALLBACK(data_get), NULL);
+       g_signal_connect(G_OBJECT(button), "drag_begin", 
G_CALLBACK(button_drag_begin), NULL);
+       g_signal_connect(G_OBJECT(button), "drag_end", 
G_CALLBACK(button_drag_end), NULL);
+       g_signal_connect(G_OBJECT(button), "button_press_event", 
G_CALLBACK(signal_blocker), NULL);
+       g_signal_connect(G_OBJECT(button), "enter_notify_event", 
G_CALLBACK(signal_blocker), NULL);
+       g_signal_connect(G_OBJECT(button), "focus", G_CALLBACK(signal_blocker), 
NULL);
+
+/*endfor*/
+
+       gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, TRUE, 0);
+
+       gtk_box_pack_start(GTK_BOX(_vbox), vbox, FALSE, FALSE, 0);
+
+       return _vbox;
+}
+
+static void
+cb_xa_preferences_dialog_item_activated(GtkWidget *widget, GtkTreePath *path, 
gpointer user_data)
+{
+       XAPreferencesDialog *dialog = XA_PREFERENCES_DIALOG(user_data);
+       gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog->support.notebook), 
gtk_tree_path_get_indices(path)[0]);
+}
+
+static void
+button_drag_begin(GtkWidget *widget, GdkDragContext *context, gpointer 
user_data)
+{
+       GdkPixbuf *pixbuf = create_icon_from_widget(widget);
+
+       gtk_drag_source_set_icon_pixbuf(widget, pixbuf);
+       g_object_unref(G_OBJECT(pixbuf));
+       gtk_widget_hide(widget);
+}
+
+static void
+button_drag_end(GtkWidget *widget, GdkDragContext *context, gpointer user_data)
+{
+       gtk_widget_show(widget);
+}
+
+static void
+data_get(GtkWidget * widget, GdkDragContext *context, GtkSelectionData *data, 
guint info, guint time, gpointer user_data)
+{
+       gtk_widget_hide(widget);
+       gtk_selection_data_set(data, gdk_atom_intern("_XA_PREF_DIALOG_BUTTON", 
FALSE), 8, (const guchar*)"", 0);
+}
+
+static void
+hid_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data)
+{
+       GtkWidget *source = gtk_drag_get_source_widget(context);
+       GtkWidget *parent = gtk_widget_get_parent(source);
+
+       if(parent == GTK_WIDGET(user_data))
+       {
+               return;
+       }
+
+       gtk_widget_ref(source);
+       gtk_container_remove(GTK_CONTAINER(parent), source);
+       gtk_box_pack_start(GTK_BOX(user_data), source, FALSE, FALSE, 0);
+       gtk_widget_unref(source);
+}
+
+static void
+vis_data_received(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data)
+{
+       GtkWidget *source = gtk_drag_get_source_widget(context);
+       GtkWidget *parent = gtk_widget_get_parent(source);
+
+       gtk_widget_ref(source);
+       gtk_container_remove(GTK_CONTAINER(parent), source);
+       gtk_box_pack_start(GTK_BOX(user_data), source, FALSE, FALSE, 0);
+       gtk_widget_unref(source);
+       /* vis_reorder_buttons(user_data, source, x); */
+}
+
+static void
+vis_drag_leave(GtkWidget * widget, GdkDragContext *context, GtkSelectionData 
*data, guint info, guint time, gpointer user_data)
+{
+}
+
+static void
+vis_drag_motion(GtkWidget * widget, GdkDragContext *context, gint x, gint y, 
GtkSelectionData *data, guint info, guint time, gpointer user_data)
+{
+}
+
+static GdkPixbuf *
+create_icon_from_widget(GtkWidget *widget)
+{
+       GdkPixbuf *src, *dest;
+
+       dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, 
widget->allocation.width, widget->allocation.height);
+
+       src = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE(widget->window), 
NULL, widget->allocation.x, widget->allocation.y, 0, 0, 
widget->allocation.width, widget->allocation.height);
+
+       gdk_pixbuf_copy_area(src, 0, 0, widget->allocation.width, 
widget->allocation.height, dest, 0, 0);
+
+       g_object_unref(G_OBJECT(src));
+
+       return dest;
+}
+

Modified: xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h        
2006-11-28 18:45:10 UTC (rev 24004)
+++ xarchiver/branches/xarchiver-psybsd/src/preferences_dialog.h        
2006-11-28 21:03:07 UTC (rev 24005)
@@ -54,6 +54,9 @@
                        } sorting;
                } viewer;
        } general;
+       struct {
+               GtkWidget *notebook;
+       } support;
 };
 
 typedef struct _XAPreferencesDialogClass XAPreferencesDialogClass;

Modified: xarchiver/branches/xarchiver-psybsd/src/tool_bar.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/tool_bar.c  2006-11-28 18:45:10 UTC 
(rev 24004)
+++ xarchiver/branches/xarchiver-psybsd/src/tool_bar.c  2006-11-28 21:03:07 UTC 
(rev 24005)
@@ -155,6 +155,21 @@
        gtk_tool_item_set_expand(button, TRUE);
        tool_bar->hbox = gtk_hbox_new(FALSE, 0);
 
+       GtkEntryCompletion *compl = gtk_entry_completion_new();
+       GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING);
+
+       gtk_entry_completion_set_popup_completion(compl, FALSE);
+
+       gtk_entry_completion_set_inline_completion(compl, TRUE);
+
+       gtk_entry_set_completion(GTK_ENTRY(tool_bar->path_field), compl);
+
+       /* TODO: auto complete model */
+
+       gtk_entry_completion_set_model(compl, GTK_TREE_MODEL(store));
+
+       gtk_entry_completion_set_text_column(compl, 0);
+
        gtk_container_add(GTK_CONTAINER(button), tool_bar->hbox);
        gtk_box_pack_start(GTK_BOX(tool_bar->hbox), 
gtk_label_new(_("Location:")), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(tool_bar->hbox), tool_bar->path_field, TRUE, 
TRUE, 5);

Modified: xarchiver/branches/xarchiver-psybsd/src/widget_factory.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/widget_factory.c    2006-11-28 
18:45:10 UTC (rev 24004)
+++ xarchiver/branches/xarchiver-psybsd/src/widget_factory.c    2006-11-28 
21:03:07 UTC (rev 24005)
@@ -753,14 +753,14 @@
                                if(GTK_IS_CHECK_BUTTON(widget))
                                {
                                        
g_object_get_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
-                                       // TODO: sync?
+                                       /* TODO: sync? */
                                        g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
                                        
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
                                }
                                if(GTK_IS_CHECK_MENU_ITEM(widget))
                                {
                                        
g_object_get_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
-                                       // TODO: sync?
+                                       /* TODO: sync? */
                                        g_value_set_flags(&value, 
g_value_get_flags(&value) ^ GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), 
XA_PROPERTY_VALUE_DATA)));
                                        
g_object_set_property(G_OBJECT(user_data), g_param_spec_get_name(pspec), 
&value);
                                }

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to