static void
html_editor_image_dialog_set_height_units (EHTMLEditorImageDialog *dialog)
{
	gint requested;
	gulong natural;
	gint height = -1;

	natural = webkit_dom_html_image_element_get_natural_height (
			dialog->priv->image);
	requested = gtk_spin_button_get_value_as_int (
			GTK_SPIN_BUTTON (dialog->priv->height_edit));

	switch (gtk_combo_box_get_active (
		GTK_COMBO_BOX (dialog->priv->height_units))) {

		case 0:	/* px */
			if (gtk_widget_is_sensitive (dialog->priv->height_edit)) {
				height = requested * natural * 0.01;
			} else {
				height = natural;
			}
			webkit_dom_element_remove_attribute (
				WEBKIT_DOM_ELEMENT (dialog->priv->image), "style");
			gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE);
			break;

		case 1: /* percent */
			if (gtk_widget_is_sensitive (dialog->priv->height_edit)) {
				height = (((gdouble) requested) / natural) * 100;
			} else {
				height = 100;
			}
			webkit_dom_element_remove_attribute (
				WEBKIT_DOM_ELEMENT (dialog->priv->image), "style");
			gtk_widget_set_sensitive (dialog->priv->height_edit, TRUE);
			break;

		case 2: /* follow */
			webkit_dom_element_set_attribute (
				WEBKIT_DOM_ELEMENT (dialog->priv->image),
				"style",
				"height: auto;",
				NULL);
			gtk_widget_set_sensitive (dialog->priv->height_edit, FALSE);
			break;
	}

	if (height != -1) {
		gtk_spin_button_set_value (
			GTK_SPIN_BUTTON (dialog->priv->height_edit), height);
	}
}
Exemplo n.º 2
0
static void
eog_zoom_entry_update_sensitivity (EogZoomEntry *entry)
{
	const gboolean current_state =
	                gtk_widget_is_sensitive (entry->priv->value_entry);
	const gboolean new_state =
	                gtk_widget_is_sensitive (entry->priv->btn_zoom_in)
	                | gtk_widget_is_sensitive (entry->priv->btn_zoom_out);

	if (current_state != new_state) {
		gtk_widget_set_sensitive (entry->priv->value_entry, new_state);
	}

}
Exemplo n.º 3
0
/****************************************************************
  Move item down in queue
*****************************************************************/
static void queue_bubble_down(struct worklist_data *ptr)
{
  GtkTreePath *path;
  GtkTreeViewColumn *col;
  GtkTreeModel *model;

  if (!gtk_widget_is_sensitive(ptr->dst_view)) {
    return;
  }

  model = GTK_TREE_MODEL(ptr->dst);
  gtk_tree_view_get_cursor(GTK_TREE_VIEW(ptr->dst_view), &path, &col);
  if (path) {
    GtkTreeIter it, it_next;

    gtk_tree_model_get_iter(model, &it, path);
    it_next = it;
    if (gtk_tree_model_iter_next(model, &it_next)) {
      gtk_list_store_swap(GTK_LIST_STORE(model), &it, &it_next);

      gtk_tree_path_next(path);
      gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->dst_view), path, col, FALSE);
      commit_worklist(ptr);
    }
  }
  gtk_tree_path_free(path);
}
Exemplo n.º 4
0
static gboolean
gdm_extension_list_set_active_extension (GdmExtensionList    *widget,
                                         GdmLoginExtension *extension)
{
        GtkWidget *button;
        gboolean   was_sensitive;
        gboolean   was_activated;

        if (!gdm_login_extension_is_visible (extension)) {
                return FALSE;
        }

        was_sensitive = gtk_widget_get_sensitive (GTK_WIDGET (widget));
        gtk_widget_set_sensitive (GTK_WIDGET (widget), TRUE);

        button = GTK_WIDGET (g_object_get_data (G_OBJECT (extension),
                             "gdm-extension-list-button"));

        was_activated = FALSE;
        if (gtk_widget_is_sensitive (button)) {
                if (gtk_widget_activate (button)) {
                        was_activated = TRUE;
                }
        }

        gtk_widget_set_sensitive (GTK_WIDGET (widget), was_sensitive);
        return was_activated;
}
Exemplo n.º 5
0
/*!
 \brief sets the current points to empty array
 \param curve (MtxCurve *) pointer to curve
 \param num_points (gint) size of array to create
 */
gboolean mtx_curve_set_empty_array (MtxCurve *curve, gint num_points)
{
	gint i = 0;
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	if (priv->coords)
		g_free(priv->coords);
	priv->coords = g_new0(MtxCurveCoord,num_points);
	priv->num_points = num_points;
	priv->highest_x = 0;
	priv->highest_y = 0;
	priv->lowest_x = 0;
	priv->lowest_y = 0;
	for (i=0;i<num_points;i++)
	{
		priv->coords[i].x = 0;
		priv->coords[i].y = 0;
	}
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	if (priv->auto_rescale_id == 0)
		priv->auto_rescale_id = g_timeout_add(1000,(GSourceFunc)auto_rescale,priv);
	return TRUE;
}
Exemplo n.º 6
0
/*!
 \brief sets the current points 
 \param curve (MtxCurve *) pointer to curve
 \param num_points (gint) new value
 \param array (MtxCurveCoord*) Array of points
 */
gboolean mtx_curve_set_coords (MtxCurve *curve, gint num_points, MtxCurveCoord *array)
{
/*	gint i = 0; */
	MtxCurvePrivate *priv = MTX_CURVE_GET_PRIVATE(curve);
	g_return_val_if_fail (MTX_IS_CURVE (curve),FALSE);
	g_object_freeze_notify (G_OBJECT (curve));
	if (priv->coords)
		g_free(priv->coords);
	priv->coords = g_memdup(array,(num_points*sizeof(MtxCurveCoord)));
	priv->num_points = num_points;
	recalc_extremes(priv);
	/*
 	for (i=0;i<num_points;i++)
		printf("new coord %f,%f\n",priv->coords[i].x,priv->coords[i].y);
	*/
	g_object_thaw_notify (G_OBJECT (curve));
#if GTK_MINOR_VERSION >= 18
	if (!gtk_widget_is_sensitive(GTK_WIDGET(curve)))
		return TRUE;
#else
	if (!GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(curve)))
		return TRUE;
#endif
	if (priv->auto_rescale_id == 0)
		priv->auto_rescale_id = g_timeout_add(1000,(GSourceFunc)auto_rescale,priv);
	return TRUE;
}
Exemplo n.º 7
0
static void
toggle_sensitivity_cb (GtkWidget *widget, gpointer data)
{
  GtkWidget *target = (GtkWidget *)data;

  gtk_widget_set_sensitive (target, !gtk_widget_is_sensitive (target));
}
Exemplo n.º 8
0
static void
gtk_expander_state_changed (GtkWidget    *widget,
			    GtkStateType  previous_state)
{
  if (!gtk_widget_is_sensitive (widget))
    GTK_EXPANDER (widget)->priv->button_down = FALSE;
}
static void
cc_timezone_map_size_allocate (GtkWidget     *widget,
                               GtkAllocation *allocation)
{
  CcTimezoneMapPrivate *priv = CC_TIMEZONE_MAP (widget)->priv;
  GdkPixbuf *pixbuf;

  if (priv->background)
    g_object_unref (priv->background);

  if (!gtk_widget_is_sensitive (widget))
    pixbuf = priv->orig_background_dim;
  else
    pixbuf = priv->orig_background;

  priv->background = gdk_pixbuf_scale_simple (pixbuf,
                                              allocation->width,
                                              allocation->height,
                                              GDK_INTERP_BILINEAR);

  if (priv->color_map)
    g_object_unref (priv->color_map);

  priv->color_map = gdk_pixbuf_scale_simple (priv->orig_color_map,
                                             allocation->width,
                                             allocation->height,
                                             GDK_INTERP_BILINEAR);

  priv->visible_map_pixels = gdk_pixbuf_get_pixels (priv->color_map);
  priv->visible_map_rowstride = gdk_pixbuf_get_rowstride (priv->color_map);

  GTK_WIDGET_CLASS (cc_timezone_map_parent_class)->size_allocate (widget,
                                                                  allocation);
}
Exemplo n.º 10
0
/****************************************************************
  Source row activated
*****************************************************************/
static void src_row_callback(GtkTreeView *view, GtkTreePath *path,
			     GtkTreeViewColumn *col, gpointer data)
{
  struct worklist_data *ptr;
  GtkTreeModel *src_model, *dst_model;
  GtkTreeIter src_it, dst_it;
  gint i, ncols;

  ptr = data;

  if (!gtk_widget_is_sensitive(ptr->dst_view)) {
    return;
  }
  
  src_model = GTK_TREE_MODEL(ptr->src);
  dst_model = GTK_TREE_MODEL(ptr->dst);

  gtk_tree_model_get_iter(src_model, &src_it, path);
  gtk_list_store_append(GTK_LIST_STORE(dst_model), &dst_it);

  ncols = gtk_tree_model_get_n_columns(src_model);

  for (i = 0; i < ncols; i++) {
    GValue value = { 0, };

    gtk_tree_model_get_value(src_model, &src_it, i, &value);
    gtk_list_store_set_value(GTK_LIST_STORE(dst_model), &dst_it, i, &value);
  }
  commit_worklist(ptr);
}
Exemplo n.º 11
0
/*
 * A variant of gtk_window_activate_default that does not end up reactivating
 * the widget that [Enter] was pressed in.
 */
static void
cb_activate_default (GtkWindow *window)
{
	GtkWidget *w = gtk_window_get_default_widget (window);
	if (w && gtk_widget_is_sensitive (w))
		gtk_widget_activate (w);
}
Exemplo n.º 12
0
/*!
 \brief handles exposure events when the screen is covered and then 
 exposed. Works by copying from a backing pixmap to screen,
 \param widget (GtkWidget *) pointer to the chart object
 \param event (GdkEventExpose *) pointer to GDK event datastructure that
 encodes important info like window dimensions and depth.
 */
gboolean mtx_stripchart_expose (GtkWidget *widget, GdkEventExpose *event)
{
	MtxStripChart * chart = MTX_STRIPCHART(widget);
	MtxStripChartPrivate *priv = MTX_STRIPCHART_GET_PRIVATE(chart);
	cairo_t *cr = NULL;

#if GTK_MINOR_VERSION >= 18
	if (gtk_widget_is_sensitive(GTK_WIDGET(widget)))
#else
		if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(widget)))
#endif
		{
			cr = gdk_cairo_create(widget->window);
			gdk_cairo_set_source_pixmap(cr,priv->bg_pixmap,0,0);
			cairo_rectangle(cr,event->area.x, event->area.y,event->area.width, event->area.height);
			cairo_fill(cr);
			cairo_destroy(cr);
		}
		else
		{
			cr = gdk_cairo_create(widget->window);
			gdk_cairo_set_source_pixmap(cr,priv->bg_pixmap,0,0);
			cairo_rectangle(cr,event->area.x, event->area.y,event->area.width, event->area.height);
			cairo_fill(cr);
			cairo_set_source_rgba (cr, 0.3,0.3,0.3,0.5);
			cairo_paint(cr);
			/*
			   cairo_rectangle (cr,
			   0,0,priv->w,priv->h);
			   cairo_fill(cr);
			 */
			cairo_destroy(cr);
		}
	return FALSE;
}
static void
script_fu_response (GtkWidget *widget,
                    gint       response_id,
                    SFScript  *script)
{
  GtkWidget *action_area;

  action_area = gtk_dialog_get_action_area (GTK_DIALOG (sf_interface->dialog));

  if (! gtk_widget_is_sensitive (action_area))
    return;

  switch (response_id)
    {
    case RESPONSE_RESET:
      script_fu_reset (script);
      break;

    case GTK_RESPONSE_OK:
      gtk_widget_set_sensitive (sf_interface->table, FALSE);
      gtk_widget_set_sensitive (action_area, FALSE);

      script_fu_ok (script);
      gtk_widget_destroy (sf_interface->dialog);
      break;

    default:
      sf_status = GIMP_PDB_CANCEL;
      gtk_widget_destroy (sf_interface->dialog);
      break;
    }
}
Exemplo n.º 14
0
static void
terminal_profile_editor_focus_widget (GtkWidget *editor,
                                      const char *widget_name)
{
	GtkBuilder *builder;
	GtkWidget *widget, *page, *page_parent;

	if (widget_name == NULL)
		return;

	builder = g_object_get_data (G_OBJECT (editor), "builder");
	widget = GTK_WIDGET (gtk_builder_get_object (builder, widget_name));
	if (widget == NULL)
		return;

	page = widget;
	while (page != NULL &&
	        (page_parent = gtk_widget_get_parent (page)) != NULL &&
	        !GTK_IS_NOTEBOOK (page_parent))
		page = page_parent;

	page_parent = gtk_widget_get_parent (page);
	if (page != NULL && GTK_IS_NOTEBOOK (page_parent))
	{
		GtkNotebook *notebook;

		notebook = GTK_NOTEBOOK (page_parent);
		gtk_notebook_set_current_page (notebook, gtk_notebook_page_num (notebook, page));
	}

	if (gtk_widget_is_sensitive (widget))
		gtk_widget_grab_focus (widget);
}
Exemplo n.º 15
0
static void
update_autologin (GtkWidget      *widget,
                  UmLoginOptions *d)
{
        GtkComboBox *combo = GTK_COMBO_BOX (widget);
        GtkTreeModel *model;
        GtkTreeIter iter;
        UmUser *user;
        gboolean enabled;

        if (!gtk_widget_is_sensitive (widget))
                return;

        model = gtk_combo_box_get_model (combo);
        gtk_combo_box_get_active_iter (combo, &iter);
        gtk_tree_model_get (model, &iter, AUTOLOGIN_USER_COL, &user, -1);
        if (user) {
                enabled = TRUE;
        }
        else {
                enabled = FALSE;
                user = um_user_manager_get_user_by_id (d->manager, getuid ());
                g_object_ref (user);
        }

        um_user_set_automatic_login (user, enabled);

        g_object_unref (user);
}
Exemplo n.º 16
0
static gboolean
window_key_press_event (GtkWidget *win, GdkEventKey *event, GsShell *shell)
{
	GsShellPrivate *priv = gs_shell_get_instance_private (shell);
	GdkKeymap *keymap;
	GdkModifierType state;
	gboolean is_rtl;
	GtkWidget *button;

	button = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_back"));
	if (!gtk_widget_is_visible (button) || !gtk_widget_is_sensitive (button))
	    	return GDK_EVENT_PROPAGATE;

	state = event->state;
	keymap = gdk_keymap_get_default ();
	gdk_keymap_add_virtual_modifiers (keymap, &state);
	state = state & gtk_accelerator_get_default_mod_mask ();
	is_rtl = gtk_widget_get_direction (button) == GTK_TEXT_DIR_RTL;

	if ((!is_rtl && state == GDK_MOD1_MASK && event->keyval == GDK_KEY_Left) ||
	    (is_rtl && state == GDK_MOD1_MASK && event->keyval == GDK_KEY_Right) ||
	    event->keyval == GDK_KEY_Back) {
		gtk_widget_activate (button);
		return GDK_EVENT_STOP;
	}

	return GDK_EVENT_PROPAGATE;
}
Exemplo n.º 17
0
static void
update (void)
{
  GString *s;
  char *font_desc;
  char *font_settings;
  const char *text;
  gboolean has_feature;
  int i;

  text = gtk_entry_get_text (GTK_ENTRY (entry));

  font_desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font));

  s = g_string_new ("");

  has_feature = FALSE;
  for (i = 0; i < 24; i++)
    {
      if (!gtk_widget_is_sensitive (toggle[i]))
        continue;

      if (GTK_IS_RADIO_BUTTON (toggle[i]))
        {
          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
            {
              if (has_feature)
                g_string_append (s, ", ");
              g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
              g_string_append (s, " 1");
              has_feature = TRUE;
            }
        }
      else
        {
          if (has_feature)
            g_string_append (s, ", ");
          g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
            g_string_append (s, " 1");
          else
            g_string_append (s, " 0");
          has_feature = TRUE;
        }
    }

  font_settings = g_string_free (s, FALSE);

  gtk_label_set_text (GTK_LABEL (settings), font_settings);

  s = g_string_new ("");
  g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, text);

  gtk_label_set_markup (GTK_LABEL (label), s->str);

  g_string_free (s, TRUE);

  g_free (font_desc);
  g_free (font_settings);
}
Exemplo n.º 18
0
/*!
  \brief hte TTM expose event which handles redraw after being unobscured
  \param widget is hte pointer to the TTM drawingarea
  \param event is the pointers to the GdkEventExpose structure
  \param data is unused
  \returns TRUE
  */
G_MODULE_EXPORT gboolean logger_display_expose_event(GtkWidget * widget, GdkEventExpose *event , gpointer data)
{
	cairo_t *cr = NULL;
	GtkAllocation allocation;
	GdkWindow *window = gtk_widget_get_window(widget);
	gtk_widget_get_allocation(widget,&allocation);

	ENTER();
#if GTK_MINOR_VERSION >= 18
	if (gtk_widget_is_sensitive(GTK_WIDGET(widget)))
#else
	if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(widget)))
#endif
	{
		cr = gdk_cairo_create(window);
		gdk_cairo_set_source_pixmap(cr,ttm_data->pixmap,0,0);
		cairo_rectangle(cr,event->area.x,event->area.y,event->area.width, event->area.height);
		cairo_fill(cr);
		cairo_destroy(cr);
	}
	else	/* INSENSITIVE display so grey it */
	{
		cr = gdk_cairo_create(window);
		gdk_cairo_set_source_pixmap(cr,ttm_data->pixmap,0,0);
		cairo_rectangle(cr,event->area.x,event->area.y,event->area.width, event->area.height);
		cairo_fill(cr);
		cairo_set_source_rgba (cr, 0.3,0.3,0.3,0.5);
		cairo_rectangle(cr,0,0,allocation.width, allocation.height);
		cairo_fill(cr);
		cairo_destroy(cr);
	}
	EXIT();
	return TRUE;
}
Exemplo n.º 19
0
static gboolean
gail_expander_do_action (AtkAction *action,
                         gint      i)
{
  GtkWidget *widget;
  GailExpander *expander;
  gboolean return_value = TRUE;

  widget = GTK_ACCESSIBLE (action)->widget;
  if (widget == NULL)
    /*
     * State is defunct
     */
    return FALSE;

  if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
    return FALSE;

  expander = GAIL_EXPANDER (action);
  switch (i)
    {
    case 0:
      if (expander->action_idle_handler)
        return_value = FALSE;
      else
	expander->action_idle_handler = gdk_threads_add_idle (idle_do_action, expander);
      break;
    default:
      return_value = FALSE;
      break;
    }
  return return_value; 
}
static gboolean
gtk_scale_button_accessible_do_action (AtkAction *action,
                                       gint       i)
{
  GtkWidget *widget;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
  if (widget == NULL)
    return FALSE;

  if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
    return FALSE;

  switch (i)
    {
    case 0:
      g_signal_emit_by_name (widget, "popup");
      return TRUE;
    case 1:
      g_signal_emit_by_name (widget, "popdown");
      return TRUE;
    default:
      return FALSE;
    }
}
Exemplo n.º 21
0
static void selectcolor_paint(GtkWidget *widget) {
	cairo_t *cr;
	cr = gdk_cairo_create(widget->window);
	cairo_fill(cr);

	gint color = SELECT_COLOR(widget)->color;
	gint circle = SELECT_COLOR(widget)->circle;

	double r = ((color & 0xff0000) >> 16) / 255.0;
	double g = ((color & 0xff00) >> 8) / 255.0;
	double b = ((color & 0xff)) / 255.0;

	gboolean sensitiv = gtk_widget_is_sensitive(widget);

	int x = widget->allocation.x;
	int y = widget->allocation.y;
	int width = 10;

	if (!sensitiv) {
		r = r / 2 + 0.5;
		g = g / 2 + 0.5;
		b = b / 2 + 0.5;
	}

	double radius = 0;

	if (widget->allocation.width > widget->allocation.height) {
		width = widget->allocation.height;
		x += (widget->allocation.width - width) / 2;
		radius = widget->allocation.height / 2.0;
	} else {
		width = widget->allocation.width;
		y += (widget->allocation.height - width) / 2;
		radius = widget->allocation.width / 2.0;
	}

	cairo_set_source_rgb(cr, r, g, b);
	if (circle) {
		cairo_arc(cr, radius + x, radius + y, radius - 1, 0, 2 * M_PI);
	} else {
		cairo_rectangle(cr, x + 1, y + 1, width - 2, width - 2);
	}
	cairo_fill(cr);

	if (sensitiv) {
		cairo_set_source_rgb(cr, 0, 0, 0);
	} else {
		cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
	}

	if (circle) {
		cairo_arc(cr, radius + x, radius + y, radius - 1, 0, 2 * M_PI);
	} else {
		cairo_rectangle(cr, x + 1, y + 1, width - 2, width - 2);
	}
	cairo_stroke(cr);

	cairo_destroy(cr);
}
Exemplo n.º 22
0
Arquivo: ui.c Projeto: spk121/jahaziel
static void server_or_username_combobox_entry_changed (GtkEditable *editable, gpointer user_data)
{
    GtkButton *connect_button = user_data;

    gchar *server = gtk_editable_get_chars(GTK_EDITABLE(ui->connect_server_combobox_entry), 0, -1);
    gchar *username = gtk_editable_get_chars(GTK_EDITABLE(ui->connect_username_combobox_entry), 0, -1);

    if (strlen(server) > 0 && strlen(username) > 0)
    {
        if (gtk_widget_is_sensitive(GTK_WIDGET(connect_button)) == 0)
            gtk_widget_set_sensitive(GTK_WIDGET(connect_button), 1);
    }
    else if (gtk_widget_is_sensitive(GTK_WIDGET(connect_button)) == 1)
        gtk_widget_set_sensitive(GTK_WIDGET(connect_button), 0);
    g_free(server);
    g_free(username);
}
Exemplo n.º 23
0
/* Override the default GTK2.4 handler, which would make menu
   bindings not work when the menu-bar is hidden. */
static gboolean menu_canacaccel(GtkWidget *widget, guint signal_id, gpointer user_data) {
	/* GTK2.2 behaviour */
#if GTK_CHECK_VERSION(2,20,0)
	return gtk_widget_is_sensitive(widget);
#else
	return GTK_WIDGET_IS_SENSITIVE(widget);
#endif
}
Exemplo n.º 24
0
static void
gtk_button_state_flags_changed (GtkWidget     *widget,
                                GtkStateFlags  previous_state)
{
  GtkButton *button = GTK_BUTTON (widget);

  if (!gtk_widget_is_sensitive (widget))
    gtk_button_do_release (button, FALSE);
}
Exemplo n.º 25
0
static void
gimp_controller_list_activate_item (GimpContainerView  *view,
                                    GimpViewable       *viewable,
                                    gpointer            insert_data,
                                    GimpControllerList *list)
{
  if (gtk_widget_is_sensitive (list->edit_button))
    gtk_button_clicked (GTK_BUTTON (list->edit_button));
}
Exemplo n.º 26
0
static gboolean
menuIsSelectable(GtkWidget *menu)
{
    return !((!gtk_bin_get_child(GTK_BIN(menu)) &&
              G_OBJECT_TYPE(menu) == GTK_TYPE_MENU_ITEM) ||
             GTK_IS_SEPARATOR_MENU_ITEM(menu) ||
             !gtk_widget_is_sensitive(menu) ||
             !gtk_widget_get_visible(menu));
}
Exemplo n.º 27
0
static void
gimp_controller_list_row_activated (GtkTreeView        *tv,
                                    GtkTreePath        *path,
                                    GtkTreeViewColumn  *column,
                                    GimpControllerList *list)
{
  if (gtk_widget_is_sensitive (list->add_button))
    gtk_button_clicked (GTK_BUTTON (list->add_button));
}
Exemplo n.º 28
0
/* Handle exposure events for the color picker's drawing area */
static gint
expose_event (GtkWidget      *widget, 
              GdkEventExpose *event, 
              gpointer        data)
{
  GtkColorButton *color_button = GTK_COLOR_BUTTON (data);
  GtkAllocation allocation;
  cairo_pattern_t *checkered;
  cairo_t *cr;

  cr = gdk_cairo_create (event->window);

  gtk_widget_get_allocation (widget, &allocation);
  gdk_cairo_rectangle (cr, &allocation);
  cairo_clip (cr);

  if (gtk_color_button_has_alpha (color_button))
    {
      cairo_save (cr);

      cairo_set_source_rgb (cr, CHECK_DARK, CHECK_DARK, CHECK_DARK);
      cairo_paint (cr);

      cairo_set_source_rgb (cr, CHECK_LIGHT, CHECK_LIGHT, CHECK_LIGHT);
      cairo_scale (cr, CHECK_SIZE, CHECK_SIZE);

      checkered = gtk_color_button_get_checkered ();
      cairo_mask (cr, checkered);
      cairo_pattern_destroy (checkered);

      cairo_restore (cr);

      cairo_set_source_rgba (cr,
                             color_button->priv->color.red / 65535.,
                             color_button->priv->color.green / 65535.,
                             color_button->priv->color.blue / 65535.,
                             color_button->priv->alpha / 65535.);
    }
  else
    {
      gdk_cairo_set_source_color (cr, &color_button->priv->color);
    }

  cairo_paint (cr);

  if (!gtk_widget_is_sensitive (GTK_WIDGET (color_button)))
    {
      gdk_cairo_set_source_color (cr, &GTK_WIDGET(color_button)->style->bg[GTK_STATE_INSENSITIVE]);
      checkered = gtk_color_button_get_checkered ();
      cairo_mask (cr, checkered);
      cairo_pattern_destroy (checkered);
    }

  cairo_destroy (cr);

  return FALSE;
}
Exemplo n.º 29
0
static void
palette_import_image_add (GimpContainer *container,
                          GimpImage     *image,
                          ImportDialog  *dialog)
{
  if (! gtk_widget_is_sensitive (dialog->image_radio))
    {
      gtk_widget_set_sensitive (dialog->image_radio, TRUE);
      gimp_context_set_image (dialog->context, image);
    }
}
Exemplo n.º 30
0
static void
gimp_color_button_state_changed (GtkWidget    *widget,
                                 GtkStateType  prev_state)
{
  g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));

  if (! gtk_widget_is_sensitive (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
    gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);

  if (GTK_WIDGET_CLASS (parent_class)->state_changed)
    GTK_WIDGET_CLASS (parent_class)->state_changed (widget, prev_state);
}