Author: rpmcruz
Date: Tue Dec 2 03:45:52 2008
New Revision: 53798
URL: http://svn.opensuse.org/viewcvs/yast?rev=53798&view=rev
Log:
Corrections to last commit. Can't use functionKey for wizard buttons.
Modified:
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/YGWizard.cc
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkwizard.h
Modified: trunk/gtk/src/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Tue Dec 2 03:45:52 2008
@@ -2685,10 +2685,12 @@
YGDialog::currentDialog()->setTitle (title);
ygtk_wizard_set_help_text (wizard, _("Please wait..."));
- ygtk_wizard_set_button_label (wizard, wizard->abort_button, _("_Cancel"));
+ ygtk_wizard_set_button_label (wizard, wizard->abort_button,
+ _("_Cancel"), GTK_STOCK_CANCEL);
ygtk_wizard_set_button_str_id (wizard, wizard->abort_button, "cancel");
- ygtk_wizard_set_button_label (wizard, wizard->back_button, NULL);
- ygtk_wizard_set_button_label (wizard, wizard->next_button, _("A_pply"));
+ ygtk_wizard_set_button_label (wizard, wizard->back_button, NULL, NULL);
+ ygtk_wizard_set_button_label (wizard, wizard->next_button,
+ _("A_pply"), GTK_STOCK_APPLY);
ygtk_wizard_set_button_str_id (wizard, wizard->next_button, "accept");
ygtk_wizard_enable_button (wizard, wizard->next_button, FALSE);
g_signal_connect (G_OBJECT (wizard), "action-triggered",
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Tue Dec 2 03:45:52 2008
@@ -32,20 +32,19 @@
{
if (!m_customIcon) {
const char *stock = NULL;
- if (hasFunctionKey())
- switch (functionKey()) {
- case 1: stock = GTK_STOCK_HELP; break;
- case 2: stock = GTK_STOCK_INFO; break;
- case 3: stock = GTK_STOCK_ADD; break;
- case 4: stock = GTK_STOCK_EDIT; break;
- case 5: stock = GTK_STOCK_DELETE; break;
- case 6: stock = GTK_STOCK_EXECUTE; break;
- case 7: stock = GTK_STOCK_PREFERENCES; break;
- case 8: stock = GTK_STOCK_GO_BACK; break;
- case 9: stock = GTK_STOCK_CANCEL; break;
-// case 10: stock = GTK_STOCK_GO_FORWARD; break;
- default: break;
- }
+ switch (functionKey()) {
+ case 1: stock = GTK_STOCK_HELP; break;
+ case 2: stock = GTK_STOCK_INFO; break; // Info
+ case 3: stock = GTK_STOCK_ADD; break;
+ case 4: stock = GTK_STOCK_EDIT; break;
+ case 5: stock = GTK_STOCK_DELETE; break;
+ case 6: stock = GTK_STOCK_EXECUTE; break; // Test
+ case 7: stock = GTK_STOCK_PREFERENCES; break; // Expert
+ case 8: stock = GTK_STOCK_GO_BACK; break;
+ case 9: stock = GTK_STOCK_CANCEL; break;
+// case 10: stock = GTK_STOCK_GO_FORWARD; break;
+ default: break;
+ }
#if YAST2_VERSION >= 2017006
switch (role()) {
case YOKButton:
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Tue Dec 2 03:45:52 2008
@@ -549,8 +549,8 @@
str.erase (str.size()-1, 1);
}
-bool YGUtils::setStockIcon (GtkWidget *button, const std::string &label,
- const char *fallbackIcon)
+const char *YGUtils::setStockIcon (GtkWidget *button, const std::string &label,
+ const char *fallbackIcon)
{
static bool firstTime = true; static std::map stockMap;
if (firstTime) {
@@ -600,7 +600,7 @@
if (image)
gtk_widget_hide (image);
}
- return foundIcon;
+ return foundIcon ? icon : NULL;
}
@@ -672,9 +672,8 @@
return g_string_free (str, FALSE);
}
-gboolean ygutils_setStockIcon (GtkWidget *button, const char *label,
- const char *fallbackIcon)
-{ return YGUtils::setStockIcon (button, label, fallbackIcon); }
+const char *ygutils_setStockIcon (GtkWidget *button, const char *label, const char *fallback)
+{ return YGUtils::setStockIcon (button, label, fallback); }
/* interactive busy cursor */
// half cursor, half clock cursor is not a Xlib theme icon, but there is
Modified: trunk/gtk/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Tue Dec 2 03:45:52 2008
@@ -49,8 +49,8 @@
GdkPixbuf *setOpacity (const GdkPixbuf *src, int opacity, bool touchAlpha);
/* Tries to make sense out of the string, applying some stock icon to the button. */
- bool setStockIcon (GtkWidget *button, const std::string &label,
- const char *fallbackIcon);
+ const char *setStockIcon (GtkWidget *button, const std::string &label,
+ const char *fallbackIcon);
};
extern "C" {
@@ -60,8 +60,8 @@
void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top);
- gboolean ygutils_setStockIcon (GtkWidget *button, const char *label,
- const char *fallbackIcon);
+ const char *ygutils_setStockIcon (GtkWidget *button, const char *label,
+ const char *fallbackIcon);
GdkPixbuf *ygutils_setOpacity (const GdkPixbuf *src, int opacity, gboolean useAlpha);
Modified: trunk/gtk/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWizard.cc?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/YGWizard.cc (original)
+++ trunk/gtk/src/YGWizard.cc Tue Dec 2 03:45:52 2008
@@ -40,8 +40,13 @@
virtual void setLabel (const string &label)
{
YPushButton::setLabel (label);
+
+ // notice: we can't use functionKey() to deduce the icon because yast
+ // tools code differ from the text-mode to the GUIs when setting buttons
+ // up, and the opt_f10 and so on will not be set in the GUI code
+ YGtkWizard *wizard = getWizard();
std::string _label = YGUtils::mapKBAccel (label);
- ygtk_wizard_set_button_label (getWizard(), getWidget(), _label.c_str());
+ ygtk_wizard_set_button_label (wizard, getWidget(), _label.c_str(), NULL);
}
virtual void setEnabled (bool enable)
@@ -60,8 +65,8 @@
virtual int preferredHeight() { return 0; }
virtual void setSize (int w, int h) {}
- GtkWidget *getWidget() { return m_widget; }
- YGtkWizard *getWizard() { return YGTK_WIZARD (m_wizard->getWidget()); }
+ inline GtkWidget *getWidget() { return m_widget; }
+ inline YGtkWizard *getWizard() { return YGTK_WIZARD (m_wizard->getWidget()); }
private:
GtkWidget *m_widget;
@@ -258,13 +263,13 @@
virtual void showReleaseNotesButton (const string &label, const string &id)
{
string str = YGUtils::mapKBAccel (label.c_str());
- ygtk_wizard_set_button_label (getWizard(), m_notes_button->getWidget(), str.c_str());
+ ygtk_wizard_set_button_label (getWizard(), m_notes_button->getWidget(), str.c_str(), NULL);
ygtk_wizard_set_button_str_id (getWizard(), m_notes_button->getWidget(), id.c_str());
}
virtual void hideReleaseNotesButton()
{
- ygtk_wizard_set_button_label (getWizard(), m_notes_button->getWidget(), NULL);
+ ygtk_wizard_set_button_label (getWizard(), m_notes_button->getWidget(), NULL, NULL);
}
virtual void retranslateInternalButtons()
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Tue Dec 2 03:45:52 2008
@@ -27,7 +27,7 @@
// YGUtils bridge
extern void ygutils_setWidgetFont (GtkWidget *widget, PangoStyle style,
PangoWeight weight, double scale);
-extern gboolean ygutils_setStockIcon (GtkWidget *button, const char *label,
+extern const char *ygutils_setStockIcon (GtkWidget *button, const char *label,
const char *fallbackIcon);
extern GdkPixbuf *ygutils_setOpacity (const GdkPixbuf *src, int opacity, gboolean alpha);
extern void ygdialog_setTitle (const gchar *title, gboolean sticky);
@@ -876,19 +876,19 @@
return TRUE;
}
-void ygtk_wizard_set_button_label (YGtkWizard *wizard, GtkWidget *button, const char *_label)
+void ygtk_wizard_set_button_label (YGtkWizard *wizard, GtkWidget *button,
+ const char *_label, const char *stock)
{
const char *label = _label ? _label : "";
gtk_button_set_label (GTK_BUTTON (button), label);
ENABLE_WIDGET_STR (label, button);
- const char *stock = 0;
if (button == wizard->abort_button)
stock = GTK_STOCK_CANCEL;
- else if (button == wizard->next_button)
- stock = GTK_STOCK_APPLY;
else if (button == wizard->release_notes_button)
stock = GTK_STOCK_EDIT;
- ygutils_setStockIcon (button, label, stock);
+
+ const char *_stock = ygutils_setStockIcon (button, label, stock);
+ g_object_set_data (G_OBJECT (button), "icon-fallback", _stock ? 0 : GINT_TO_POINTER (1));
}
void ygtk_wizard_set_button_str_id (YGtkWizard *wizard, GtkWidget *button, const char *id)
Modified: trunk/gtk/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/gtk/src/ygtkwizard.h (original)
+++ trunk/gtk/src/ygtkwizard.h Tue Dec 2 03:45:52 2008
@@ -143,7 +143,7 @@
gboolean ygtk_wizard_set_header_icon (YGtkWizard *wizard, const char *icon);
void ygtk_wizard_set_button_label (YGtkWizard *wizard, GtkWidget *button,
- const char *text);
+ const char *text, const char *stock);
void ygtk_wizard_enable_button (YGtkWizard *wizard, GtkWidget *button,
gboolean enable);
void ygtk_wizard_set_button_str_id (YGtkWizard *wizard, GtkWidget *button,
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org