r1724 - trunk/src/target/OM-2007/openmoko-libs/libmokoui
mickey at sita.openmoko.org
mickey at sita.openmoko.org
Wed Apr 11 01:37:05 CEST 2007
Author: mickey
Date: 2007-04-11 01:37:04 +0200 (Wed, 11 Apr 2007)
New Revision: 1724
Removed:
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.c
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.h
Modified:
trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro
trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c
Log:
libmokoui: remove outdated code (moko-search-bar)
GtkTreeView: add fixed mode to improve performance
GtkTreeView: try to set the adjustment to scroll the full height of entries... doesn't work though :(
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro 2007-04-10 21:42:58 UTC (rev 1723)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/libmokoui.pro 2007-04-10 23:37:04 UTC (rev 1724)
@@ -16,7 +16,6 @@
moko-panel-applet.h \
moko-pixmap-button.h \
moko-paned-window.h \
- moko-search-bar.h \
moko-tool-box.h \
moko-tree-view.h \
moko-window.h
@@ -35,7 +34,6 @@
moko-panel-applet.c \
moko-pixmap-button.c \
moko-paned-window.c \
- moko-search-bar.c \
moko-tree-view.c \
moko-tool-box.c \
moko-window.c
Deleted: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.c 2007-04-10 21:42:58 UTC (rev 1723)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.c 2007-04-10 23:37:04 UTC (rev 1724)
@@ -1,66 +0,0 @@
-
-/* moko_search_bar.c
- *
- * Authored by Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- * Copyright (C) 2006-2007 OpenMoko Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser Public License as published by
- * the Free Software Foundation; version 2 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser Public License for more details.
- *
- * Current Version: $Rev$ ($Date) [$Author: mickey $]
- */
-
-#include "moko-search-bar.h"
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkentry.h>
-
-G_DEFINE_TYPE (MokoSearchBar, moko_search_bar, GTK_TYPE_TOOLBAR)
-
-#define MOKO_SEARCH_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_SEARCH_BAR, MokoSearchBarPrivate))
-
-typedef struct _MokoSearchBarPrivate MokoSearchBarPrivate;
-
-struct _MokoSearchBarPrivate
-{
- GtkWidget* alignment; /* GtkAlignment */
- GtkWindow* entry; /* GtkEntry */
-};
-
-static void
-moko_search_bar_class_init (MokoSearchBarClass *klass);
-static void
-moko_search_bar_init (MokoSearchBar *self);
-
-static void
-moko_search_bar_class_init (MokoSearchBarClass *klass)
-{
- /* GObjectClass *object_class = G_OBJECT_CLASS (klass); */
-
- g_type_class_add_private (klass, sizeof (MokoSearchBarPrivate));
-}
-
-static void
-moko_search_bar_init (MokoSearchBar *self)
-{
- GtkToolItem* item = gtk_tool_item_new();
- gtk_widget_set_size_request( GTK_WIDGET(item), 320, 10 ); //FIXME get from style
- GtkWidget* entry = gtk_entry_new();
- gtk_widget_set_name( entry, "moko_search_entry" );
- gtk_entry_set_has_frame( GTK_ENTRY (entry), FALSE );
- gtk_entry_set_text( GTK_ENTRY(entry), "foo" );
- gtk_container_add( GTK_CONTAINER(item), entry );
- gtk_toolbar_insert( GTK_TOOLBAR (self), GTK_TOOL_ITEM(item), 0 );
-}
-
-GtkWidget*
-moko_search_bar_new (void)
-{
- return GTK_WIDGET(g_object_new(moko_search_bar_get_type(), NULL));
-}
Deleted: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.h 2007-04-10 21:42:58 UTC (rev 1723)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-search-bar.h 2007-04-10 23:37:04 UTC (rev 1724)
@@ -1,50 +0,0 @@
-
-/* moko_search_bar.h
- *
- * Authored by Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- * Copyright (C) 2006-2007 OpenMoko Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser Public License as published by
- * the Free Software Foundation; version 2 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser Public License for more details.
- *
- * Current Version: $Rev$ ($Date) [$Author: mickey $]
- */
-
-#ifndef _MOKO_SEARCH_BAR_H_
-#define _MOKO_SEARCH_BAR_H_
-
-#include <glib-object.h>
-#include <gtk/gtktoolbar.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_SEARCH_BAR (moko_search_bar_get_type())
-#define MOKO_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_SEARCH_BAR, MokoSearchBar))
-#define MOKO_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_SEARCH_BAR, MokoSearchBarClass))
-#define MOKO_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_SEARCH_BAR))
-#define MOKO_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_SEARCH_BAR))
-#define MOKO_SEARCH_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_SEARCH_BAR, MokoSearchBarClass))
-
-typedef struct {
- GtkToolbar parent;
-} MokoSearchBar;
-
-typedef struct {
- GtkToolbarClass parent_class;
-} MokoSearchBarClass;
-
-GType moko_search_bar_get_type (void);
-
-GtkWidget* moko_search_bar_new (void);
-
-G_END_DECLS
-
-#endif // _MOKO_SEARCH_BAR_H_
-
Modified: trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c 2007-04-10 21:42:58 UTC (rev 1723)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokoui/moko-tree-view.c 2007-04-10 23:37:04 UTC (rev 1724)
@@ -83,6 +83,9 @@
{
gtk_tree_view_column_set_alignment( column, 0.5 );
gtk_tree_view_column_set_spacing( column, 4 );
+ gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_FIXED );
+ //FIXME grab from state information
+ gtk_tree_view_column_set_fixed_width( column, 100 );
gtk_tree_view_append_column( GTK_TREE_VIEW(self), column );
g_object_set( G_OBJECT(column),
@@ -90,14 +93,33 @@
"reorderable", TRUE,
"sort-indicator", TRUE,
NULL );
+
}
GtkWidget* moko_tree_view_put_into_scrolled_window(MokoTreeView* self)
{
+ // compute value for vadjustment
+ gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(self), TRUE );
+ GtkTreeViewColumn* first_column = gtk_tree_view_get_column( GTK_TREE_VIEW(self), 0 );
+ g_assert( first_column ); // fail here if no columns added yet
+ gint cr_x_offset;
+ gint cr_y_offset;
+ gint cr_width;
+ gint cr_height;
+ gtk_tree_view_column_cell_get_size( first_column, NULL, &cr_x_offset, &cr_y_offset, &cr_width, &cr_height );
+
GtkWidget* scrolledwindow = gtk_scrolled_window_new( NULL, NULL );
//FIXME get from style or (even better) set as initial size hint in MokoPanedWindow (also via style sheet of course)
gtk_widget_set_size_request( scrolledwindow, 0, 170 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
- gtk_container_add( GTK_CONTAINER (scrolledwindow), GTK_WIDGET (self) );
+ gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS );
+ gtk_container_add( GTK_CONTAINER(scrolledwindow), GTK_WIDGET(self) );
+
+ //FIXME this doesn't work :/ the idea is to set the step and page increment, so that we never scroll
+ //to anything else but a fully visible entry (as opposed to half way visible)
+ GtkAdjustment* vadjustment = gtk_tree_view_get_vadjustment( GTK_TREE_VIEW(self) );
+ g_debug( "vadjustment page increment = %d", vadjustment->page_increment );
+ vadjustment->step_increment = 1;
+ vadjustment->page_increment = 1;
+ vadjustment->page_size = 1;
return scrolledwindow;
}
More information about the commitlog
mailing list