Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] r58693 - in /trunk/gtk: ./ src/ tests/
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Mon, 21 Sep 2009 16:35:41 -0000
  • Message-id: <E1Mplra-0006Wo-8D@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Mon Sep 21 18:35:41 2009
New Revision: 58693

URL: http://svn.opensuse.org/viewcvs/yast?rev=58693&view=rev
Log:
* tests/Layout-Truncated-Widget.ycp: uncovered difference
in our layout mechanism to qt's. We may want to address this
in the future.

* src/YGDialog.cc: increased default size.

* src/YGDialog.cc: don't tell GTK to change cursor to the one
already in use.

* src/YGPackageSelector.cc, src/YGUI.h/cc: moved statment of
software manager default size here.

* src/ygtkbargraph.h/c: make it inherit from GtkFrame, and
changed frame look.

* src/ygtkratiobox.c: make use of GtkContainer's border_width
and make last widget take rest of the size.

* src/ygtkrichtext.c & src/ygtktextview.c: instead of
selecting link on right-click, make it select any word under
the mouse cursor.

* src/ygtksteps.h/c: look more yast2-qt: adopted qt's mark
glyphs and added glyphs for todo tasks.

* src/ygtkzyppview.cc: touched up run Firefox as user logic.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/ygtkbargraph.c
trunk/gtk/src/ygtkbargraph.h
trunk/gtk/src/ygtkfindentry.h
trunk/gtk/src/ygtkratiobox.c
trunk/gtk/src/ygtkrichtext.c
trunk/gtk/src/ygtksteps.c
trunk/gtk/src/ygtksteps.h
trunk/gtk/src/ygtktextview.c
trunk/gtk/src/ygtkzyppview.cc
trunk/gtk/src/ygtkzyppview.h
trunk/gtk/tests/Layout-Truncated-Widget.ycp

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Sep 21 18:35:41 2009
@@ -1,3 +1,32 @@
+2009-09-21 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * tests/Layout-Truncated-Widget.ycp: uncovered difference
+ in our layout mechanism to qt's. We may want to address this
+ in the future.
+
+ * src/YGDialog.cc: increased default size.
+
+ * src/YGDialog.cc: don't tell GTK to change cursor to the one
+ already in use.
+
+ * src/YGPackageSelector.cc, src/YGUI.h/cc: moved statment of
+ software manager default size here.
+
+ * src/ygtkbargraph.h/c: make it inherit from GtkFrame, and
+ changed frame look.
+
+ * src/ygtkratiobox.c: make use of GtkContainer's border_width
+ and make last widget take rest of the size.
+
+ * src/ygtkrichtext.c & src/ygtktextview.c: instead of
+ selecting link on right-click, make it select any word under
+ the mouse cursor.
+
+ * src/ygtksteps.h/c: look more yast2-qt: adopted qt's mark
+ glyphs and added glyphs for todo tasks.
+
+ * src/ygtkzyppview.cc: touched up run Firefox as user logic.
+
2009-09-14 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/YGPackageSelector.cc: disable install tab when

Modified: trunk/gtk/src/YGDialog.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Mon Sep 21 18:35:41 2009
@@ -23,8 +23,8 @@
be a YGDialog and is swap-able.
*/

-#define DEFAULT_WIDTH 650
-#define DEFAULT_HEIGHT 600
+#define DEFAULT_WIDTH 700
+#define DEFAULT_HEIGHT 650

class YGWindow;
static YGWindow *main_window = 0;
@@ -37,6 +37,7 @@
// (ie. dump yast tree)
YWidget *m_child;
GdkCursor *m_busyCursor;
+ bool m_isBusy;

public:
YGWindowCloseFn m_canClose;
@@ -52,6 +53,7 @@
m_child = NULL;
m_canClose = NULL;
m_busyCursor = NULL;
+ m_isBusy = false;

{
std::stack<YDialog *> &stack = YDialog::_dialogStack;
@@ -135,17 +137,21 @@

void normalCursor()
{
- gdk_window_set_cursor (m_widget->window, NULL);
+ if (m_isBusy)
+ gdk_window_set_cursor (m_widget->window, NULL);
+ m_isBusy = false;
}

void busyCursor()
{
- GdkDisplay *display = gtk_widget_get_display (m_widget);
if (!m_busyCursor) {
+ GdkDisplay *display = gtk_widget_get_display (m_widget);
m_busyCursor = gdk_cursor_new_for_display (display,
GDK_WATCH);
gdk_cursor_ref (m_busyCursor);
}
- gdk_window_set_cursor (m_widget->window, m_busyCursor);
+ if (!m_isBusy)
+ gdk_window_set_cursor (m_widget->window, m_busyCursor);
+ m_isBusy = true;
}

void setChild (YWidget *new_child)

Modified: trunk/gtk/src/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Mon Sep 21 18:35:41 2009
@@ -36,9 +36,12 @@
return true;
}

+void YGUI::pkgSelectorSize (int *width, int *height)
+{ *width = 700; *height = 800; }
+
//** UI components -- split up for re-usability, but mostly for readability

-class FlexPane
+class FlexPane // TODO: deprecate in favor of using GTK 2.16 new
GtkOrientation API
{
GtkWidget *m_bin, *m_child1, *m_child2;
bool m_isVertical, m_resize1, m_resize2, m_shrink1, m_shrink2;
@@ -1365,6 +1368,7 @@
//view->appendIconColumn (NULL,
ZyppModel::ICON_COLUMN);
view->appendTextColumn (NULL,
ZyppModel::NAME_SUMMARY_COLUMN, 350);
view->appendButtonColumn (NULL, col);
+ view->setRulesHint (true);
}
else {
if (!m_onlineUpdate || nb == 0)

Modified: trunk/gtk/src/YGUI.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Mon Sep 21 18:35:41 2009
@@ -35,7 +35,7 @@
#define BUSY_CURSOR_TIMEOUT 250

YGUI::YGUI (bool with_threads)
- : YUI (with_threads), m_done_init (false), busy_timeout (0)
+ : YUI (with_threads), m_done_init (false), busy_timeout (0), m_block
(false)
{
IMPL
m_have_wm = true;
@@ -111,10 +111,8 @@
for (int i = 1; i < argc; i++) {
const char *argp = argv[i];
if (argp[0] != '-') {
- if (!strcmp (argp, "sw_single") || !strcmp (argp,
"online_update")) {
- m_default_width = 700;
- m_default_height = 800;
- }
+ if (!strcmp (argp, "sw_single") || !strcmp (argp,
"online_update"))
+ YGUI::pkgSelectorSize (&m_default_width,
&m_default_height);
continue;
}
argp++;
@@ -220,8 +218,11 @@
if (timeout)
g_source_remove (timeout);

- if (block) // if YCP keeps working for more than X time, set busy
cursor
+ if (block) { // if YCP keeps working for more than X time, set busy
cursor
+ if (busy_timeout)
+ g_source_remove (busy_timeout);
busy_timeout = g_timeout_add (BUSY_CURSOR_TIMEOUT,
busy_timeout_cb, this);
+ }
return event;
}

@@ -531,21 +532,21 @@
{
bool reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
if (sym == YUIGlyph_ArrowLeft)
- return reverse ? "\u2192" : "\u2190";
+ return reverse ? "\u25b6" : "\u25c0";
if (sym == YUIGlyph_ArrowRight)
- return reverse ? "\u2190" : "\u2192";
+ return reverse ? "\u25c0" : "\u25b6";
if (sym == YUIGlyph_ArrowUp)
- return "\u2191";
+ return "\u25b2";
if (sym == YUIGlyph_ArrowDown)
- return "\u2193";
+ return "\u25bc";
if (sym == YUIGlyph_CheckMark)
return "\u2714";
if (sym == YUIGlyph_BulletArrowRight)
return reverse ? "\u21e6" : "\u279c";
if (sym == YUIGlyph_BulletCircle)
- return "\u274d";
+ return "\u26ab";
if (sym == YUIGlyph_BulletSquare)
- return "\u274f";
+ return "\u25fe";
return "";
}


Modified: trunk/gtk/src/YGUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Mon Sep 21 18:35:41 2009
@@ -70,6 +70,7 @@
private:
bool m_done_init;
guint busy_timeout; // for busy cursor
+ bool m_block;
static gboolean busy_timeout_cb (gpointer data);

// window-related arguments
@@ -77,6 +78,7 @@
int m_default_width, m_default_height;

bool pkgSelectorParse (const char *arg);
+ void pkgSelectorSize (int *width, int *height);

public:
// Helpers for internal use [ visibility hidden ]

Modified: trunk/gtk/src/ygtkbargraph.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.c?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkbargraph.c (original)
+++ trunk/gtk/src/ygtkbargraph.c Mon Sep 21 18:35:41 2009
@@ -6,15 +6,18 @@
// check the header file for information about this widget

#include <config.h>
+#include "ygtkratiobox.h"
#include "ygtkbargraph.h"
#include <gtk/gtk.h>

-G_DEFINE_TYPE (YGtkBarGraph, ygtk_bar_graph, YGTK_TYPE_RATIO_HBOX)
+G_DEFINE_TYPE (YGtkBarGraph, ygtk_bar_graph, GTK_TYPE_FRAME)

static void ygtk_bar_graph_init (YGtkBarGraph *bar)
{
-// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (bar), TRUE);
- gtk_container_set_border_width (GTK_CONTAINER (bar), 12);
+ GtkWidget *box = ygtk_ratio_hbox_new (0);
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (bar), box);
+ ygtk_bar_graph_set_style (bar, TRUE);
}

static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition
*requisition)
@@ -30,7 +33,7 @@

void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries)
{
- YGtkRatioBox *box = YGTK_RATIO_BOX (bar);
+ YGtkRatioBox *box = YGTK_RATIO_BOX (GTK_BIN (bar)->child);

// Remove the ones in excess
guint i;
@@ -56,8 +59,8 @@

static GtkWidget *ygtk_bar_graph_get_label (YGtkBarGraph *bar, int index,
GtkWidget **b)
{
- GtkWidget *box = ((YGtkRatioBoxChild *) g_list_nth_data (
- YGTK_RATIO_BOX (bar)->children, index))->widget;
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ GtkWidget *box = ((YGtkRatioBoxChild *) g_list_nth_data
(hbox->children, index))->widget;
if (b) *b = box;
return gtk_bin_get_child (GTK_BIN (box));
}
@@ -92,7 +95,8 @@

// Set proportion
gtk_widget_set_size_request (box, 0, -1);
- ygtk_ratio_box_set_child_packing (YGTK_RATIO_BOX (bar), box, MAX
(value, 1));
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ ygtk_ratio_box_set_child_packing (hbox, box, MAX (value, 1));

// Set background color
// The Tango palette
@@ -135,6 +139,8 @@
void ygtk_bar_graph_set_style (YGtkBarGraph *bar, gboolean flat)
{
bar->flat = flat;
+ GtkShadowType shadow = flat ? GTK_SHADOW_OUT : GTK_SHADOW_NONE;
+ gtk_frame_set_shadow_type (GTK_FRAME (bar), shadow);
}

void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor
*color)

Modified: trunk/gtk/src/ygtkbargraph.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.h?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkbargraph.h (original)
+++ trunk/gtk/src/ygtkbargraph.h Mon Sep 21 18:35:41 2009
@@ -9,7 +9,7 @@
#ifndef YGTK_BAR_GRAPH_H
#define YGTK_BAR_GRAPH_H

-#include "ygtkratiobox.h"
+#include <gtk/gtkframe.h>
G_BEGIN_DECLS

#define YGTK_TYPE_BAR_GRAPH (ygtk_bar_graph_get_type ())
@@ -29,14 +29,14 @@

struct _YGtkBarGraph
{
- YGtkRatioHBox parent;
+ GtkFrame parent;
// members:
guint flat : 2;
};

struct _YGtkBarGraphClass
{
- YGtkRatioHBoxClass parent_class;
+ GtkFrameClass parent_class;
};

GtkWidget *ygtk_bar_graph_new (void);

Modified: trunk/gtk/src/ygtkfindentry.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.h?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkfindentry.h (original)
+++ trunk/gtk/src/ygtkfindentry.h Mon Sep 21 18:35:41 2009
@@ -14,6 +14,8 @@
YGtkFindEntry is a convinience widget that has a find icon, with an
optional menu, at the left, and an erase icon at the right. It can
interact with an option image menu, and does auto-completion.
+
+ TODO: deprecate in favor of using GtkEntry 2.16 new APIs.
*/

#ifndef YGTK_FIND_ENTRY_H

Modified: trunk/gtk/src/ygtkratiobox.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkratiobox.c (original)
+++ trunk/gtk/src/ygtkratiobox.c Mon Sep 21 18:35:41 2009
@@ -121,6 +121,10 @@
requisition->width += spacing;
else
requisition->height += spacing;
+
+ int border = GTK_CONTAINER (box)->border_width;
+ requisition->width += border*2;
+ requisition->height += border*2;
}

static void ygtk_ratio_box_size_allocate (GtkWidget *widget,
@@ -144,11 +148,15 @@

gint spacing = children_nb ? box->spacing*(children_nb-1) : 0;

+ int border = GTK_CONTAINER (box)->border_width;
+ int x = allocation->x + border, y = allocation->y + border,
+ width = allocation->width - border*2, height = allocation->height -
border*2;
+
gint length;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- length = allocation->width - spacing;
+ length = width - spacing;
else
- length = allocation->height - spacing;
+ length = height - spacing;
gint child_pos = 0;

for (i = box->children; i; i = i->next) {
@@ -160,18 +168,20 @@
gtk_widget_get_child_requisition (child->widget, &child_req);

gint child_length = (child->ratio * length) / ratios_sum;
+ if (!i->next) // last takes rest (any residual length)
+ child_length = length - child_pos;

GtkAllocation child_alloc;
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
- child_alloc.x = allocation->x + child_pos;
- child_alloc.y = allocation->y;
+ child_alloc.x = x + child_pos;
+ child_alloc.y = y;
child_alloc.width = child_length;
- child_alloc.height = allocation->height;
+ child_alloc.height = height;
}
else { // GTK_ORIENTATION_VERTICAL
- child_alloc.x = allocation->x;
- child_alloc.y = allocation->y + child_pos;
- child_alloc.width = allocation->width;
+ child_alloc.x = x;
+ child_alloc.y = y + child_pos;
+ child_alloc.width = width;
child_alloc.height = child_length;
}


Modified: trunk/gtk/src/ygtkrichtext.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Mon Sep 21 18:35:41 2009
@@ -686,39 +686,11 @@
g_object_ref (G_OBJECT (pixbuf));
}

-static gboolean ygtk_rich_text_button_press_event (GtkWidget *widget,
GdkEventButton *event)
-{ // if right-click on links, select the entire link, so the user can
then easily copy it
- if (event->button == 3) {
- GtkTextView *view = GTK_TEXT_VIEW (widget);
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
- if (!gtk_text_buffer_get_has_selection (buffer)) {
- gint buffer_x, buffer_y;
- gtk_text_view_window_to_buffer_coords (view,
- GTK_TEXT_WINDOW_WIDGET, (gint) event->x, (gint)
event->y, &buffer_x, &buffer_y);
- GtkTextIter iter;
- gtk_text_view_get_iter_at_location (view, &iter,
buffer_x, buffer_y);
- if (get_link_at_iter (view, &iter)) {
- GtkTextIter start = iter, end = iter;
- while (gtk_text_view_move_visually (view,
&start, -1))
- if (!get_link_at_iter (view, &start))
- break;
- gtk_text_view_move_visually (view, &start, +1);
- while (gtk_text_view_move_visually (view, &end,
+1))
- if (!get_link_at_iter (view, &end))
- break;
- gtk_text_buffer_select_range (buffer, &start,
&end);
- }
- }
- }
- return GTK_WIDGET_CLASS
(ygtk_rich_text_parent_class)->button_press_event (widget, event);
-}
-
static void ygtk_rich_text_class_init (YGtkRichTextClass *klass)
{
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->motion_notify_event =
ygtk_rich_text_motion_notify_event;
gtkwidget_class->expose_event = ygtk_rich_text_expose_event;
- gtkwidget_class->button_press_event = ygtk_rich_text_button_press_event;

GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
gtkobject_class->destroy = ygtk_rich_text_destroy;

Modified: trunk/gtk/src/ygtksteps.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtksteps.c (original)
+++ trunk/gtk/src/ygtksteps.c Mon Sep 21 18:35:41 2009
@@ -26,15 +26,16 @@
gtk_box_set_spacing (GTK_BOX (steps), 8);
gtk_container_set_border_width (GTK_CONTAINER (steps), 4);

+ const gchar *check = "\u2714", *current = "\u25b6", *todo = "\u26ab";
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
+ current = "\u25c0";
PangoContext *context = gtk_widget_get_pango_context (GTK_WIDGET
(steps));
steps->check_mark_layout = pango_layout_new (context);
steps->current_mark_layout = pango_layout_new (context);
-
- const gchar *check = "\u2714", *current = "<b>\u2192</b>";
- if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
- current = "<b>\u2190</b>";
- pango_layout_set_markup (steps->check_mark_layout, check, -1);
- pango_layout_set_markup (steps->current_mark_layout, current, -1);
+ steps->todo_mark_layout = pango_layout_new (context);
+ pango_layout_set_text (steps->check_mark_layout, check, -1);
+ pango_layout_set_text (steps->current_mark_layout, current, -1);
+ pango_layout_set_text (steps->todo_mark_layout, todo, -1);
steps->current_mark_timeout_id = steps->current_mark_frame = 0;
}

@@ -50,7 +51,9 @@
steps->check_mark_layout = NULL;
if (steps->current_mark_layout)
g_object_unref (steps->current_mark_layout);
- steps->current_mark_layout = NULL;
+ if (steps->todo_mark_layout)
+ g_object_unref (steps->todo_mark_layout);
+ steps->todo_mark_layout = NULL;
GTK_OBJECT_CLASS (ygtk_steps_parent_class)->destroy (object);
}

@@ -88,34 +91,36 @@
cairo_set_source_rgb (cr, 0, 0, 0);
int n = 0;
for (i = children; i; i = i->next, n++) {
- if (n <= steps->current_step) {
- GtkWidget *label = i->data;
- if (g_object_get_data (G_OBJECT (label), "is-header"))
- continue;
- PangoLayout *mark = (n == steps->current_step) ?
- steps->current_mark_layout :
steps->check_mark_layout;
- int x = label->allocation.x, y = label->allocation.y;
- if (reverse) {
- PangoRectangle rect;
- pango_layout_get_pixel_extents (mark, NULL,
&rect);
- x += label->allocation.width - rect.width - 4;
- }
+ GtkWidget *label = i->data;
+ if (g_object_get_data (G_OBJECT (label), "is-header"))
+ continue;
+ PangoLayout *layout;
+ if (n < steps->current_step)
+ layout = steps->check_mark_layout;
+ else if (n == steps->current_step)
+ layout = steps->current_mark_layout;
+ else //if (n > steps->current_step)
+ layout = steps->todo_mark_layout;
+ int x = label->allocation.x, y = label->allocation.y;
+ if (reverse) {
+ PangoRectangle rect;
+ pango_layout_get_pixel_extents (layout, NULL, &rect);
+ x += label->allocation.width - rect.width - 4;
+ }
+ else
+ x += 4;
+ if (n == steps->current_step) {
+ int offset;
+ if (steps->current_mark_frame <
CURRENT_MARK_FRAMES_NB/2)
+ offset = steps->current_mark_frame *
CURRENT_MARK_ANIMATION_OFFSET;
else
- x += 4;
- if (n == steps->current_step) {
- int offset;
- if (steps->current_mark_frame <
CURRENT_MARK_FRAMES_NB/2)
- offset = steps->current_mark_frame *
CURRENT_MARK_ANIMATION_OFFSET;
- else
- offset = (CURRENT_MARK_FRAMES_NB -
steps->current_mark_frame) *
- CURRENT_MARK_ANIMATION_OFFSET;
- x += offset * (reverse ? 1 : -1);
- }
-
-
- cairo_move_to (cr, x, y);
- pango_cairo_show_layout (cr, mark);
+ offset = (CURRENT_MARK_FRAMES_NB -
steps->current_mark_frame) *
+ CURRENT_MARK_ANIMATION_OFFSET;
+ x += offset * (reverse ? 1 : -1);
}
+
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
}
cairo_destroy (cr);
g_list_free (children);

Modified: trunk/gtk/src/ygtksteps.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.h?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtksteps.h (original)
+++ trunk/gtk/src/ygtksteps.h Mon Sep 21 18:35:41 2009
@@ -39,7 +39,7 @@

// private:
gint current_step;
- PangoLayout *check_mark_layout, *current_mark_layout;
+ PangoLayout *check_mark_layout, *current_mark_layout, *todo_mark_layout;
// for current_mark little animation
guint current_mark_timeout_id, current_mark_frame;


Modified: trunk/gtk/src/ygtktextview.c
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktextview.c?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtktextview.c (original)
+++ trunk/gtk/src/ygtktextview.c Mon Sep 21 18:35:41 2009
@@ -65,6 +65,40 @@
gtk_widget_show_all (GTK_WIDGET (menu));
}

+static inline gboolean is_space (gunichar ch)
+{ return g_unichar_isspace (ch) || ch == 0xfffc; }
+
+static gboolean ygtk_text_view_button_press_event (GtkWidget *widget,
GdkEventButton *event)
+{ // on right-click, select word under cursor if there is no selection
+ if (event->button == 3) {
+ GtkTextView *view = GTK_TEXT_VIEW (widget);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+ if (!gtk_text_buffer_get_has_selection (buffer)) {
+ gint buffer_x, buffer_y;
+ gtk_text_view_window_to_buffer_coords (view,
+ GTK_TEXT_WINDOW_WIDGET, (gint) event->x, (gint)
event->y, &buffer_x, &buffer_y);
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location (view, &iter,
buffer_x, buffer_y);
+
+ if (!is_space (gtk_text_iter_get_char (&iter))) {
+ GtkTextIter start, end = iter, temp = iter;
+ do {
+ start = temp;
+ if (!gtk_text_iter_backward_char
(&temp))
+ break;
+ } while (!is_space (gtk_text_iter_get_char
(&temp)));
+ do {
+ if (!gtk_text_iter_forward_char (&end))
+ break;
+ } while (!is_space (gtk_text_iter_get_char
(&end)));
+
+ gtk_text_buffer_select_range (buffer, &start,
&end);
+ }
+ }
+ }
+ return GTK_WIDGET_CLASS
(ygtk_text_view_parent_class)->button_press_event (widget, event);
+}
+
GtkWidget *ygtk_text_view_new (gboolean editable)
{ return g_object_new (YGTK_TYPE_TEXT_VIEW, "editable", editable, NULL); }

@@ -75,5 +109,6 @@

GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = ygtk_text_view_realize;
+ gtkwidget_class->button_press_event = ygtk_text_view_button_press_event;
}


Modified: trunk/gtk/src/ygtkzyppview.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.cc?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.cc (original)
+++ trunk/gtk/src/ygtkzyppview.cc Mon Sep 21 18:35:41 2009
@@ -31,23 +31,30 @@
{ return g_file_test (BROWSER_PATH, G_FILE_TEST_IS_EXECUTABLE); }
inline bool CAN_OPEN_DIRNAME()
{ return g_file_test (GNOME_OPEN_PATH, G_FILE_TEST_IS_EXECUTABLE); }
+
+void run (const std::string &cmd, bool as_user)
+{
+ std::string prepend, append;
+ if (as_user && getuid() == 0) {
+ char *username = getenv ("USER");
+ if (strcmp (username, "root") != 0) {
+ prepend.reserve (64);
+ prepend = "gnomesu -u ";
+ prepend += username;
+ prepend += " -c \"";
+ append = "\"";
+ }
+ }
+ system (((prepend + cmd + append) + " &").c_str());
+}
+
void OPEN_URL (const char *uri)
{
std::string command;
command.reserve (256);
command = BROWSER_PATH " --new-window ";
command += uri;
-
- char *username = getenv ("USERNAME");
- std::string gnomesu, gnomesu_end; // we don't want to run the browser
as root
- if (username) { // run as the user that owns the session
- gnomesu.reserve (64);
- gnomesu = "gnomesu -u ";
- gnomesu += username;
- gnomesu += " -c \"";
- gnomesu_end = "\"";
- }
- system ((gnomesu + command + gnomesu_end + " &").c_str());
+ run (command, true);
}
void OPEN_DIRNAME (const char *uri)
{
@@ -56,7 +63,7 @@
command = GNOME_OPEN_PATH " ";
command += uri;
command += " &";
- system (command.c_str());
+ run (command, false);
}

static GdkPixbuf *loadPixbuf (const char *icon)
@@ -876,12 +883,13 @@
gtk_tree_view_column_set_fixed_width (column, size);
else
gtk_tree_view_column_set_expand (column, TRUE);
- if (col == ZyppModel::NAME_SUMMARY_COLUMN)
- gtk_tree_view_set_rules_hint (view, TRUE);
// gtk_tree_view_insert_column (view, column, reverse ? 0 : -1);
gtk_tree_view_append_column (view, column);
}

+ void setRulesHint (bool hint)
+ { gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (m_view), TRUE); }
+
GtkTreeSelection *getTreeSelection()
{ return gtk_tree_view_get_selection (GTK_TREE_VIEW (m_view)); }

@@ -1193,6 +1201,9 @@
void YGtkPackageView::appendTextColumn (const char *header, int col, int size,
bool identAuto)
{ impl->appendTextColumn (header, col, size, identAuto); }

+void YGtkPackageView::setRulesHint (bool hint)
+{ impl->setRulesHint (hint); }
+
void YGtkPackageView::setListener (Listener *listener)
{ impl->m_listener = listener; }


Modified: trunk/gtk/src/ygtkzyppview.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppview.h?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppview.h (original)
+++ trunk/gtk/src/ygtkzyppview.h Mon Sep 21 18:35:41 2009
@@ -62,6 +62,7 @@
void appendIconColumn (const char *header, int col);
void appendTextColumn (const char *header, int col, int size = -1, bool
identAuto = false);
// (set all column headers to NULL in order to hide them.)
+ void setRulesHint (bool hint);

struct Listener {
virtual void packagesSelected (Ypp::PkgList packages) = 0;

Modified: trunk/gtk/tests/Layout-Truncated-Widget.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/tests/Layout-Truncated-Widget.ycp?rev=58693&r1=58692&r2=58693&view=diff
==============================================================================
--- trunk/gtk/tests/Layout-Truncated-Widget.ycp (original)
+++ trunk/gtk/tests/Layout-Truncated-Widget.ycp Mon Sep 21 18:35:41 2009
@@ -8,13 +8,14 @@

UI::OpenDialog
(
- `VBox
+ `MarginBox (5, 5, `VBox
(
`ReplacePoint(`id(`kill_replaceable), `PushButton( `id(`kill),
"I am a waste of space" )),
`PushButton( `id(`transform), select(strings, cur_string, nil)
),
- `PushButton( `id(`quit), "Exit" )
+ `Left (`PushButton( `id(`quit), "Exit" ))
)
+ )
);

any button_id = nil;

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages