Author: rpmcruz Date: Tue Dec 1 03:56:40 2009 New Revision: 59866 URL: http://svn.opensuse.org/viewcvs/yast?rev=59866&view=rev Log: * src/YGUtils.cc: bug fix 559226: Allow '&' to be escaped. * src/YGPushButton.cc: bug fix 558900. Default button state forgotten. * src/YGTable.cc: bug fix 548058: Default button state forgotten. * src/YGPackageSelector.cc: partial bug fix for 548437: honor a couple of the flags. Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGFrame.cc trunk/gtk/src/YGPackageSelectorPluginStub.cc trunk/gtk/src/YGPushButton.cc trunk/gtk/src/YGTable.cc trunk/gtk/src/YGUI.h trunk/gtk/src/YGUtils.cc trunk/gtk/src/pkg/YGPackageSelector.cc trunk/gtk/src/pkg/YGPackageSelectorPluginImpl.h trunk/gtk/src/pkg/ygtkpackageview.cc trunk/gtk/src/ygtklinklabel.h trunk/gtk/src/ygtkwizard.c Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Tue Dec 1 03:56:40 2009 @@ -1,9 +1,22 @@ -2009-10-26 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> +2009-12-01 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> + + * src/YGUtils.cc: bug fix 559226: Allow '&' to be escaped. + + * src/YGPushButton.cc: bug fix 558900. Default button + state forgotten. + + * src/YGTable.cc: bug fix 548058: Default button + state forgotten. + + * src/YGPackageSelector.cc: partial bug fix for 548437: + honor a couple of the flags. + +2009-11-26 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * src/YGPackageSelector.cc: added support for search based on description, filelist and author. -2009-10-26 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> +2009-11-26 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * Reverted to development state. Modified: trunk/gtk/src/YGFrame.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGFrame.cc (original) +++ trunk/gtk/src/YGFrame.cc Tue Dec 1 03:56:40 2009 @@ -10,7 +10,7 @@ // Instead of traditional looking frames, we use Gnome convention for the // frame's look. That is: don't draw a frame, use bold header and pad the child. -#define CHILD_INDENTATION 20 +#define CHILD_INDENTATION 12 class YGBaseFrame : public YGWidget { Modified: trunk/gtk/src/YGPackageSelectorPluginStub.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelectorPluginStub.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGPackageSelectorPluginStub.cc (original) +++ trunk/gtk/src/YGPackageSelectorPluginStub.cc Tue Dec 1 03:56:40 2009 @@ -85,10 +85,9 @@ return NULL; } -#if 0 // YOptionalWidgetFactory -YPackageSelector* YGOptionalWidgetFactory::createPatternSelector (YWidget* parent, long modeFlags) +YWidget* YGOptionalWidgetFactory::createPatternSelector (YWidget* parent, long modeFlags) { YGPackageSelectorPluginStub *plugin = YGPackageSelectorPluginStub::get(); if (plugin) @@ -96,12 +95,11 @@ return NULL; } -YPackageSelector* YGOptionalWidgetFactory::createSimplePatchSelector (YWidget* parent, long modeFlags) +YWidget* YGOptionalWidgetFactory::createSimplePatchSelector (YWidget* parent, long modeFlags) { YGPackageSelectorPluginStub *plugin = YGPackageSelectorPluginStub::get(); if (plugin) return plugin->createSimplePatchSelector (parent, modeFlags); return NULL; } -#endif Modified: trunk/gtk/src/YGPushButton.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGPushButton.cc (original) +++ trunk/gtk/src/YGPushButton.cc Tue Dec 1 03:56:40 2009 @@ -121,19 +121,21 @@ { struct inner { static void realize_cb (GtkWidget *widget) - { gtk_widget_grab_focus (widget); } + { + GtkWidget *window = gtk_widget_get_toplevel (widget); + gtk_widget_grab_default (widget); + gtk_widget_grab_focus (widget); + } }; YPushButton::setDefaultButton (isDefault); if (isDefault) { GtkWidget *button = getWidget(); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); - gtk_widget_grab_default (button); if (GTK_WIDGET_REALIZED (button)) - gtk_widget_grab_focus (button); - else - g_signal_connect (G_OBJECT (button), "realize", - G_CALLBACK (inner::realize_cb), this); + inner::realize_cb (button); + g_signal_connect (G_OBJECT (button), "realize", + G_CALLBACK (inner::realize_cb), this); } } @@ -146,6 +148,7 @@ } return true; } + #if 0 static gboolean treat_icon_cb (GtkWidget *widget, GdkEventExpose *event, YGPushButton *pThis) Modified: trunk/gtk/src/YGTable.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGTable.cc (original) +++ trunk/gtk/src/YGTable.cc Tue Dec 1 03:56:40 2009 @@ -236,6 +236,7 @@ #include "YTable.h" #include "YGDialog.h" #include <gdk/gdkkeysyms.h> +#include <string.h> class YGTable : public YTable, public YGTableView { @@ -321,6 +322,9 @@ int index = (n*2)+1; if (!sortable) index = -1; + gtk_tree_sortable_set_sort_func ( + GTK_TREE_SORTABLE (getModel()), index, tree_sort_cb, + GINT_TO_POINTER (index), NULL); gtk_tree_view_column_set_sort_column_id (column, index); } else @@ -418,6 +422,18 @@ return FALSE; } + static gint tree_sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, + gpointer _index) + { + int index = GPOINTER_TO_INT (_index); + gchar *str_a, *str_b; + gtk_tree_model_get (model, a, index, &str_a, -1); + gtk_tree_model_get (model, b, index, &str_b, -1); + int ret = strcmp (str_a, str_b); + g_free (str_a); + g_free (str_b); + return ret; + } }; #if YAST2_VERSION >= 2017005 Modified: trunk/gtk/src/YGUI.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGUI.h (original) +++ trunk/gtk/src/YGUI.h Tue Dec 1 03:56:40 2009 @@ -179,10 +179,10 @@ virtual bool hasContextMenu() RET (true) - virtual bool hasSimplePatchSelector() RET (false) - virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags) RET (NULL) - virtual bool hasPatternSelector() RET (false) - virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags) RET (NULL) + virtual bool hasSimplePatchSelector() RET (true) + virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags); + virtual bool hasPatternSelector() RET (true) + virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags); }; #include <YApplication.h> Modified: trunk/gtk/src/YGUtils.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/YGUtils.cc (original) +++ trunk/gtk/src/YGUtils.cc Tue Dec 1 03:56:40 2009 @@ -287,17 +287,22 @@ return ret; } -string YGUtils::mapKBAccel (const string &src) +std::string YGUtils::mapKBAccel (const std::string &src) { - // we won't use use replace since we also want to escape _ to __ std::string::size_type length = src.length(), i; string str; str.reserve (length); for (i = 0; i < length; i++) { if (src[i] == '_') str += "__"; - else if (src[i] == '&') - str += '_'; + else if (src[i] == '&') { + if (i+1 < length && src[i+1] == '&') { + str += '&'; // escaping + i++; + } + else + str += '_'; + } else str += src[i]; } Modified: trunk/gtk/src/pkg/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/pkg/YGPackageSelector.cc (original) +++ trunk/gtk/src/pkg/YGPackageSelector.cc Tue Dec 1 03:56:40 2009 @@ -7,6 +7,7 @@ #define YUILogComponent "gtk" #include "config.h" +#include <YPackageSelector.h> #include <string.h> #include "YGUI.h" #include "YGUtils.h" @@ -1902,7 +1903,10 @@ static void icon_press_cb (GtkEntry *entry, GtkEntryIconPosition pos, GdkEvent *event, SearchEntry *pThis) - { gtk_entry_set_text (entry, ""); } + { + gtk_entry_set_text (entry, ""); + gtk_widget_grab_focus (GTK_WIDGET (entry)); + } static void grab_focus_cb (GtkWidget *widget) { gtk_widget_grab_focus (widget); } @@ -2225,8 +2229,14 @@ public: GtkWidget *getWidget() { return m_widget; } - UI() : m_type (Ypp::Package::PACKAGE_TYPE) + UI (YPackageSelector *sel) { + if (sel->onlineUpdateMode()) + m_type = Ypp::Package::PATCH_TYPE; + else if (!sel->searchMode()) + m_type = Ypp::Package::PATTERN_TYPE; + else + m_type = Ypp::Package::PACKAGE_TYPE; YGtkPackageView *view = ygtk_package_view_new (TRUE); view->setListener (this); m_view = GTK_WIDGET (view); @@ -2238,10 +2248,17 @@ gtk_paned_pack2 (GTK_PANED (view_pane), m_details->getWidget(), FALSE, TRUE); GtkWidget *combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Package")); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Pattern")); - gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Language")); - gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); + if (sel->onlineUpdateMode()) { + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Patch")); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); + } + else { + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Package")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Pattern")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Language")); + int i = sel->searchMode() ? 0 : 1; + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i); + } g_signal_connect (G_OBJECT (combo), "changed", G_CALLBACK (type_changed_cb), this); @@ -2369,7 +2386,6 @@ } }; -#include <YPackageSelector.h> #include "pkg-selector-help.h" class YGPackageSelector : public YPackageSelector, public YGWidget, public Ypp::Interface @@ -2425,7 +2441,7 @@ /* m_notebook = new QueryNotebook (onlineUpdate, repoMgrEnabled()); gtk_box_pack_start (GTK_BOX (vbox), m_notebook->getWidget(), TRUE, TRUE, 0); */ - UI *ui = new UI(); + UI *ui = new UI (this); gtk_box_pack_start (GTK_BOX (vbox), ui->getWidget(), TRUE, TRUE, 0); gtk_widget_hide (empty); @@ -2528,5 +2544,22 @@ YPackageSelector * YGPackageSelectorPluginImpl::createPackageSelector (YWidget *parent, long modeFlags) -{ return new YGPackageSelector (parent, modeFlags); } +{ + modeFlags &= YPkg_SearchMode; + return new YGPackageSelector (parent, modeFlags); +} + +YWidget * +YGPackageSelectorPluginImpl::createPatternSelector (YWidget *parent, long modeFlags) +{ + modeFlags ^= YPkg_SearchMode; + return new YGPackageSelector (parent, modeFlags); +} + +YWidget * +YGPackageSelectorPluginImpl::createSimplePatchSelector (YWidget *parent, long modeFlags) +{ + modeFlags &= YPkg_OnlineUpdateMode; + return new YGPackageSelector (parent, modeFlags); +} Modified: trunk/gtk/src/pkg/YGPackageSelectorPluginImpl.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelectorPluginImpl.h?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/pkg/YGPackageSelectorPluginImpl.h (original) +++ trunk/gtk/src/pkg/YGPackageSelectorPluginImpl.h Tue Dec 1 03:56:40 2009 @@ -14,8 +14,8 @@ { public: virtual YPackageSelector *createPackageSelector (YWidget *parent, long modeFlags); - virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags) { return 0; } - virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags) { return 0; } + virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags); + virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags); }; #endif /*YGPACKAGE_SELECTOR_PLUGIN_IMPL_H*/ Modified: trunk/gtk/src/pkg/ygtkpackageview.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpackageview.cc?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/pkg/ygtkpackageview.cc (original) +++ trunk/gtk/src/pkg/ygtkpackageview.cc Tue Dec 1 03:56:40 2009 @@ -680,6 +680,7 @@ gtk_tree_view_set_search_column (view, NAME_PROP); gtk_tree_view_set_fixed_height_mode (view, TRUE); gtk_tree_view_set_headers_visible (view, FALSE); + gtk_tree_view_set_enable_tree_lines (view, TRUE); GtkTreeSelection *selection = gtk_tree_view_get_selection (view); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); @@ -957,6 +958,7 @@ gtk_tree_view_column_add_attribute (column, renderer, "xpad", XPAD_PROP); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_resizable (column, TRUE); +// gtk_tree_view_column_set_reorderable (column, TRUE); if (size >= 0) gtk_tree_view_column_set_fixed_width (column, size); else Modified: trunk/gtk/src/ygtklinklabel.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtklinklabel.h?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/ygtklinklabel.h (original) +++ trunk/gtk/src/ygtklinklabel.h Tue Dec 1 03:56:40 2009 @@ -3,7 +3,11 @@ ********************************************************************/ /* A label with embed links. Because we only need a link at the end, that's - only what we support. */ + only what we support. + + In the future, we may want to use GtkLabel's new link support instead of + this custom widget. +*/ #ifndef YGTK_LINK_LABEL_H #define YGTK_LINK_LABEL_H Modified: trunk/gtk/src/ygtkwizard.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=59866&r1=59865&r2=59866&view=diff ============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Tue Dec 1 03:56:40 2009 @@ -642,8 +642,10 @@ GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->realize (widget); YGtkWizard *wizard = YGTK_WIZARD (widget); if (wizard->m_default_button) { - gtk_widget_grab_default (wizard->m_default_button); - gtk_widget_grab_focus (wizard->m_default_button); + GtkWidget *window = gtk_widget_get_toplevel (widget); + if (GTK_IS_WINDOW (window)) + if (!gtk_window_get_default_widget (GTK_WINDOW (window))) + gtk_widget_grab_default (wizard->m_default_button); } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org