예제 #1
0
static void
ipreferences_merge (IAnjutaPreferences* ipref,
                    AnjutaPreferences* prefs,
                    GError** e)
{
    GError* error = NULL;
    GtkBuilder* bxml = gtk_builder_new ();
    GtkTreeView *global_vars_view = NULL;
    GtkButton *add_variable_b = NULL, *delete_variable_b = NULL;
    SnippetsManagerPlugin *snippets_manager_plugin = NULL;
    GlobalVariablesUpdateData *global_vars_update_data = NULL;

    /* Assertions */
    snippets_manager_plugin = ANJUTA_PLUGIN_SNIPPETS_MANAGER (ipref);
    g_return_if_fail (ANJUTA_IS_PLUGIN_SNIPPETS_MANAGER (snippets_manager_plugin));

    if (!gtk_builder_add_from_file (bxml, PREFERENCES_UI, &error))
    {
        g_warning ("Couldn't load preferences ui file: %s", error->message);
        g_error_free (error);
    }
    anjuta_preferences_add_from_builder (prefs, bxml, SNIPPETS_MANAGER_PREFERENCES_ROOT, _("Code Snippets"),
                                         ICON_FILE);

    /* Get the Gtk objects */
    global_vars_view  = GTK_TREE_VIEW (gtk_builder_get_object (bxml, "global_vars_view"));
    add_variable_b    = GTK_BUTTON (gtk_builder_get_object (bxml, "add_var_button"));
    delete_variable_b = GTK_BUTTON (gtk_builder_get_object (bxml, "delete_var_button"));
    g_return_if_fail (GTK_IS_TREE_VIEW (global_vars_view));
    g_return_if_fail (GTK_IS_BUTTON (add_variable_b));
    g_return_if_fail (GTK_IS_BUTTON (delete_variable_b));

    /* Set up the Global Variables GtkTreeView */
    set_up_global_variables_view (snippets_manager_plugin, global_vars_view);

    /* Connect the addition/deletion buttons */
    global_vars_update_data = g_malloc (sizeof (GlobalVariablesUpdateData));
    global_vars_update_data->snippets_db = snippets_manager_plugin->snippets_db;
    global_vars_update_data->global_vars_view = global_vars_view;

    g_signal_connect (GTK_OBJECT (add_variable_b),
                      "clicked",
                      GTK_SIGNAL_FUNC (on_add_variable_b_clicked),
                      global_vars_update_data);

    g_signal_connect (GTK_OBJECT (delete_variable_b),
                      "clicked",
                      GTK_SIGNAL_FUNC (on_delete_variable_b_clicked),
                      global_vars_update_data);

    g_object_unref (bxml);
}
예제 #2
0
/**
 * gtk_button_set_icon_name:
 * @button: A #GtkButton
 * @icon_name: A icon name
 *
 * Adds a #GtkImage with the given icon name as a child. The icon will be
 * of size %GTK_ICON_SIZE_BUTTON. If @button already contains a child widget,
 * that child widget will be removed and replaced with the image.
 *
 * Since: 3.90
 */
void
gtk_button_set_icon_name (GtkButton  *button,
                          const char *icon_name)
{
  GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
  GtkWidget *child;
  GtkStyleContext *context;

  g_return_if_fail (GTK_IS_BUTTON (button));
  g_return_if_fail (icon_name != NULL);

  child = gtk_bin_get_child (GTK_BIN (button));
  context = gtk_widget_get_style_context (GTK_WIDGET (button));

  if (priv->child_type != ICON_CHILD || child == NULL)
    {
      if (child != NULL)
        gtk_container_remove (GTK_CONTAINER (button), child);

      child = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
      gtk_widget_show (child);
      gtk_container_add (GTK_CONTAINER (button), child);
      gtk_style_context_remove_class (context, "text-button");
      gtk_style_context_add_class (context, "image-button");
    }
  else
    {
      gtk_image_set_from_icon_name (GTK_IMAGE (child), icon_name, GTK_ICON_SIZE_BUTTON);
    }

  gtk_button_set_child_type (button, ICON_CHILD);
  g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ICON_NAME]);
}
예제 #3
0
/**
 * gtk_button_get_use_underline:
 * @button: a #GtkButton
 *
 * Returns whether an embedded underline in the button label indicates a
 * mnemonic. See gtk_button_set_use_underline().
 *
 * Returns: %TRUE if an embedded underline in the button label
 *               indicates the mnemonic accelerator keys.
 */
gboolean
gtk_button_get_use_underline (GtkButton *button)
{
  g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);

  return button->priv->use_underline;
}
예제 #4
0
/**
 * gtk_button_set_use_underline:
 * @button: a #GtkButton
 * @use_underline: %TRUE if underlines in the text indicate mnemonics
 *
 * If true, an underline in the text of the button label indicates
 * the next character should be used for the mnemonic accelerator key.
 */
void
gtk_button_set_use_underline (GtkButton *button,
			      gboolean   use_underline)
{
  GtkButtonPrivate *priv;

  g_return_if_fail (GTK_IS_BUTTON (button));

  priv = button->priv;

  use_underline = use_underline != FALSE;

  if (use_underline != priv->use_underline)
    {
      if (priv->child_type == LABEL_CHILD)
        {
          GtkWidget *child;
          child = gtk_bin_get_child (GTK_BIN (button));

          gtk_label_set_use_underline (GTK_LABEL (child), use_underline);
          gtk_label_set_mnemonic_widget (GTK_LABEL (child), GTK_WIDGET (button));
        }

      priv->use_underline = use_underline;
      g_object_notify_by_pspec (G_OBJECT (button), props[PROP_USE_UNDERLINE]);
    }
}
예제 #5
0
/**
 * gtk_button_set_label:
 * @button: a #GtkButton
 * @label: a string
 *
 * Sets the text of the label of the button to @label.
 *
 * This will also clear any previously set labels.
 */
void
gtk_button_set_label (GtkButton   *button,
                      const gchar *label)
{
  GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
  GtkWidget *child;
  GtkStyleContext *context;

  g_return_if_fail (GTK_IS_BUTTON (button));

  context = gtk_widget_get_style_context (GTK_WIDGET (button));

  child = gtk_bin_get_child (GTK_BIN (button));

  if (priv->child_type != LABEL_CHILD || child == NULL)
    {
      if (child != NULL)
        gtk_container_remove (GTK_CONTAINER (button), child);

      child = gtk_label_new (NULL);
      if (priv->use_underline)
        {
          gtk_label_set_use_underline (GTK_LABEL (child), priv->use_underline);
          gtk_label_set_mnemonic_widget (GTK_LABEL (child), GTK_WIDGET (button));
        }
      gtk_widget_show (child);
      gtk_container_add (GTK_CONTAINER (button), child);
      gtk_style_context_remove_class (context, "image-button");
      gtk_style_context_add_class (context, "text-button");
    }

  gtk_label_set_label (GTK_LABEL (child), label);
  gtk_button_set_child_type (button, LABEL_CHILD);
  g_object_notify_by_pspec (G_OBJECT (button), props[PROP_LABEL]);
}
예제 #6
0
extern int NLDT_gtk_signal_connect(struct lua_State *L)
{
	/*
		LUA Use:
			gtk_signal_connect(widget, "signal", "lua_function")
	*/
	if(lua_gettop(L)!=3)
	{
		lua_pushstring(L,"ERROR gtk_signal_connect usage widget, \"signal\", \"lua_func\"\n");
		lua_error(L);
	}
	GtkWidget *widget = (GtkWidget*)luaL_checkint(L,1);
	char *callback = (char*)lua_tostring(L,2);
	char *lua_func = (char*)lua_tostring(L,3);
	callback_data *cback = g_new(callback_data,1);
	cback->gizmo = nldt_gizmo_lookup(L);
	cback->func_name = g_strdup(lua_func);
	if(GTK_IS_BUTTON(widget))
	{
		g_signal_connect(G_OBJECT(widget),callback,G_CALLBACK(NLDT_button_click_callback),cback);
	}	
	if(GTK_IS_LABEL(widget))
	{
		printf("hehe, silly rabbit, callbacks are for buttons!\n");
	}
	return 0;
}
static void
gb_rename_file_popover__button_clicked (GbRenameFilePopover *self,
                                        GtkButton           *button)
{
  g_autoptr(GFile) file = NULL;
  g_autoptr(GFile) parent = NULL;
  const gchar *path;

  g_assert (GB_IS_RENAME_FILE_POPOVER (self));
  g_assert (GTK_IS_BUTTON (button));
  g_assert (self->file != NULL);
  g_assert (G_IS_FILE (self->file));

  path = gtk_entry_get_text (self->entry);
  if (ide_str_empty0 (path))
    return;

  parent = g_file_get_parent (self->file);
  file = g_file_get_child (parent, path);

  /* only activate once */
  gtk_widget_set_sensitive (GTK_WIDGET (self->button), FALSE);

  g_signal_emit (self, signals [RENAME_FILE], 0, self->file, file);
}
예제 #8
0
static void
ide_editor_spell_widget__add_button_clicked_cb (IdeEditorSpellWidget *self,
                                                GtkButton            *button)
{
  const gchar *word;
  GtkWidget *item;
  GtkWidget *toplevel;
  GtkWidget *focused_widget;

  g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self));
  g_assert (GTK_IS_BUTTON (button));

  word = gtk_entry_get_text (GTK_ENTRY (self->dict_word_entry));
  /* TODO: check if word already in dict */
  if (check_dict_available (self) && !ide_str_empty0 (word))
    {
      if (!ide_editor_spell_dict_add_word_to_personal (self->dict, word))
        return;

      item = dict_create_word_row (self, word);
      gtk_list_box_insert (GTK_LIST_BOX (self->dict_words_list), item, 0);

      toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
      if (GTK_IS_WINDOW (toplevel) &&
          NULL != (focused_widget = gtk_window_get_focus (GTK_WINDOW (toplevel))))
        {
          if (focused_widget != GTK_WIDGET (self->word_entry) &&
              focused_widget != self->dict_word_entry)
            gtk_widget_grab_focus (self->dict_word_entry);
        }

      gtk_entry_set_text (GTK_ENTRY (self->dict_word_entry), "");

    }
}
static void
kolab_folder_metadata_ui_foldertype_cb (GtkRadioButton *btn,
                                        gpointer userdata)
{
	KolabFolderMetaUIData *uidata = NULL;
	KolabFolderTypeID foldertype = KOLAB_FOLDER_TYPE_INVAL;
	GtkWidget *ok_btn = NULL;
	gpointer type = NULL;

	g_return_if_fail (GTK_IS_RADIO_BUTTON (btn));
	g_return_if_fail (userdata != NULL);

	uidata = (KolabFolderMetaUIData *) userdata;
	g_return_if_fail (uidata->widgets != NULL);

	type = g_hash_table_lookup (uidata->widgets->folder_type_map,
	                            (gpointer) btn);
	if (type != NULL)
		foldertype = GPOINTER_TO_UINT (type);

	if ((foldertype > KOLAB_FOLDER_TYPE_INVAL) &&
	    (foldertype < KOLAB_FOLDER_LAST_TYPE)) {
		uidata->metadata->foldertype = foldertype;
		uidata->changed_metadata = TRUE;
	}

	ok_btn = e_kolab_plugin_util_ui_dialog_ref_button (uidata->dialog,
	                                                   GTK_STOCK_OK,
	                                                   TRUE);
	g_return_if_fail (GTK_IS_BUTTON (ok_btn));
	gtk_widget_set_sensitive (ok_btn, TRUE);
	g_object_unref (ok_btn);
}
static void
kolab_folder_metadata_ui_syncstrategy_cb (GtkComboBoxText *box,
                                          gpointer userdata)
{
	GtkWidget *ok_btn = NULL;
	KolabFolderMetaUIData *uidata = NULL;
	gint active = 0;

	g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (box));
	g_return_if_fail (userdata != NULL);

	uidata = (KolabFolderMetaUIData *) userdata;
	g_return_if_fail (uidata->metadata != NULL);

	active = gtk_combo_box_get_active (GTK_COMBO_BOX (box));
	uidata->metadata->strategy = (KolabFolderTypeID) active;
	uidata->changed_syncstrategy = TRUE;

	ok_btn = e_kolab_plugin_util_ui_dialog_ref_button (uidata->dialog,
	                                                   GTK_STOCK_OK,
	                                                   TRUE);
	g_return_if_fail (GTK_IS_BUTTON (ok_btn));
	gtk_widget_set_sensitive (ok_btn, TRUE);
	g_object_unref (ok_btn);
}
예제 #11
0
void
glade_gtk_button_post_create (GladeWidgetAdaptor * adaptor,
                              GObject * button, GladeCreateReason reason)
{
  GladeWidget *gbutton = glade_widget_get_from_gobject (button);

  g_return_if_fail (GTK_IS_BUTTON (button));
  g_return_if_fail (GLADE_IS_WIDGET (gbutton));

  if (GTK_IS_FONT_BUTTON (button))
    g_signal_connect
        (button, "font-set",
         G_CALLBACK (glade_gtk_font_button_refresh_font_name), gbutton);
  else if (GTK_IS_COLOR_BUTTON (button))
    g_signal_connect
        (button, "color-set",
         G_CALLBACK (glade_gtk_color_button_refresh_color), gbutton);

  /* Disabled response-id until its in an action area */
  glade_widget_property_set_sensitive (gbutton, "response-id", FALSE,
                                       RESPID_INSENSITIVE_MSG);

  if (reason == GLADE_CREATE_USER)
    glade_gtk_button_update_stock (gbutton);
}
예제 #12
0
static void
gimp_dialog_response (GtkDialog *dialog,
                      gint       response_id)
{
  GList *children;
  GList *list;

  children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));

  for (list = children; list; list = g_list_next (list))
    {
      GtkWidget *widget = list->data;

      if (gtk_dialog_get_response_for_widget (dialog, widget) == response_id)
        {
          if (! GTK_IS_BUTTON (widget) ||
              gtk_button_get_focus_on_click (GTK_BUTTON (widget)))
            {
              gtk_widget_grab_focus (widget);
            }

          break;
        }
    }

  g_list_free (children);
}
예제 #13
0
static void
gtk_label_accessible_initialize (AtkObject *obj,
                                 gpointer   data)
{
  GtkWidget  *widget;
  GtkLabelAccessible *accessible;

  ATK_OBJECT_CLASS (_gtk_label_accessible_parent_class)->initialize (obj, data);

  accessible = GTK_LABEL_ACCESSIBLE (obj);

  widget = GTK_WIDGET (data);

  accessible->text = g_strdup (gtk_label_get_text (GTK_LABEL (widget)));

  /*
   * Check whether ancestor of GtkLabel is a GtkButton and if so
   * set accessible parent for GtkLabelAccessible
   */
  while (widget != NULL)
    {
      widget = gtk_widget_get_parent (widget);
      if (GTK_IS_BUTTON (widget))
        {
          atk_object_set_parent (obj, gtk_widget_get_accessible (widget));
          break;
        }
    }

  obj->role = ATK_ROLE_LABEL;
}
예제 #14
0
void widget_set_sensitive(GtkWidget * widget, gboolean sensitive)
{
	GtkWidget *button;

	gtk_widget_set_sensitive(widget, sensitive);

	/** @bug Gtk bug 56070. If the mouse is over a toolbar button that
	 *  becomes sensitive, one can't click it without moving the mouse out
	 *  and in again. This bug is registered in Bugzilla as a Gtk bug. The
	 *  workaround tests if the mouse is inside the currently sensitivized
	 *  button, and if yes call button_enter()
	 */
	if (!GTK_IS_BIN(widget))
		return;

	button = gtk_bin_get_child(GTK_BIN(widget));
	if (sensitive && GTK_IS_BUTTON(button)) {
		gint x, y, state;
		gtk_widget_get_pointer(button, &x, &y);
		state = GTK_WIDGET_STATE(button);
		if ((state == GTK_STATE_NORMAL
		     || state == GTK_STATE_PRELIGHT) && x >= 0 && y >= 0
		    && x < button->allocation.width
		    && y < button->allocation.height) {
			gtk_button_enter(GTK_BUTTON(button));
			GTK_BUTTON(button)->in_button = TRUE;
			gtk_widget_set_state(widget, GTK_STATE_PRELIGHT);
		}
	}
}
static void
setup_device_chooser (const gchar *profile, int type, GtkWidget *combobox, GtkWidget *test_button, const gchar *test_pipeline)
{
	DeviceChooser *device_chooser;
	GtkCellRenderer *cell;
	gchar *gconf_key;

	g_return_if_fail (GTK_IS_COMBO_BOX (combobox));
	g_return_if_fail (GTK_IS_BUTTON (test_button));

	device_chooser = g_malloc0 (sizeof (DeviceChooser));

	device_chooser->profile = profile;
	device_chooser->type = type;
	device_chooser->combobox = combobox;
	device_chooser->model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
	device_chooser->test_pipeline = test_pipeline;
	gtk_combo_box_set_model (GTK_COMBO_BOX (combobox), GTK_TREE_MODEL (device_chooser->model));
	cell = gtk_cell_renderer_text_new ();
	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), cell, TRUE);
	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox), cell, "text", 1);

	device_choosers = g_list_prepend (device_choosers, device_chooser);

	gconf_key = get_gconf_key_for_profile (profile, type);
	gconf_client_notify_add (gconf_client, gconf_key, gconf_key_changed,
				 device_chooser, NULL, NULL);
	g_free (gconf_key);

	g_signal_connect (combobox, "changed", G_CALLBACK (device_changed), device_chooser);

	g_signal_connect (test_button, "clicked", G_CALLBACK (device_test_button_clicked), device_chooser);
}
예제 #16
0
static void
gwy_sensitivity_group_debug(GwySensitivityGroup *sensgroup)
{
    SensList *senslist;
    GtkWidget *widget, *w;
    GList *l, *ll;
    const gchar *s;
    gint nw = 0;

    g_printerr("SENS GROUP %p\n", sensgroup);
    for (ll = sensgroup->lists; ll; ll = g_list_next(ll)) {
        g_printerr("    LIST: ");
        senslist = (SensList*)ll->data;
        g_printerr("mask=%04x, dirty=%d, parent=%p\n",
                   senslist->mask, senslist->dirty, senslist->parent);
        for (l = senslist->widgets; l; l = g_list_next(l)) {
            nw++;
            g_printerr("        WIDGET: ");
            widget = GTK_WIDGET(l->data);
            g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(widget)));
            if (GTK_IS_BUTTON(widget)) {
                s = gtk_button_get_label(GTK_BUTTON(widget));
                if (s)
                    g_printerr("<%s> ", s);
                else {
                    w = gtk_bin_get_child(GTK_BIN(widget));
                    if (w) {
                        g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(w)));
                        if (GTK_IS_LABEL(w)) {
                            s = gtk_label_get_text(GTK_LABEL(w));
                            if (s)
                                g_printerr("<%s> ", s);
                        }
                        else if (GTK_IS_IMAGE(w)) {
                            s = NULL;
                            gtk_image_get_stock(GTK_IMAGE(w), (gchar**)&s,
                                                NULL);
                            if (s)
                                g_printerr("<%s> ", s);
                        }
                    }
                }
            }
            else if (GTK_IS_MENU_ITEM(widget)) {
                w = gtk_bin_get_child(GTK_BIN(widget));
                if (w) {
                    g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(w)));
                    if (GTK_IS_LABEL(w)) {
                        s = gtk_label_get_text(GTK_LABEL(w));
                        if (s)
                            g_printerr("<%s> ", s);
                    }
                }
            }
            g_printerr("\n");
        }
    }
    g_printerr("    nwidgets=%d, ref_count=%d\n",
               nw, G_OBJECT(sensgroup)->ref_count);
}
예제 #17
0
/* When can_focus is true, GtkButton allocates larger size than requested *
 * and causes the panel image to grow indefinitely.                       *
 * This workaround compensates for this difference.                       *
 * Details in https://bugzilla.gnome.org/show_bug.cgi?id=698030           *
 */
static gint
xfce_panel_image_padding_correction (GtkWidget *widget)
{
  GtkWidget             *parent;
  GtkStyleContext       *context;
  gint                   focus_width;
  gint                   focus_pad;
  gint                   correction;

  parent = gtk_widget_get_parent (widget);
  if (parent != NULL &&
      GTK_IS_BUTTON (parent) &&
      !gtk_widget_get_can_focus (parent))
    {
      context = gtk_widget_get_style_context (parent);
      gtk_style_context_get_style (context,
                                   "focus-line-width", &focus_width,
                                   "focus-padding", &focus_pad,
                                   NULL);
      correction = (focus_width + focus_pad) * 2;
    }
  else
    {
      correction = 0;
    }

  return correction;
}
예제 #18
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
void
gtk_button_leave (GtkButton *button)
{
  g_return_if_fail (GTK_IS_BUTTON (button));

  g_signal_emit (button, button_signals[LEAVE], 0);
}
예제 #19
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
void
gtk_button_clicked (GtkButton *button)
{
  g_return_if_fail (GTK_IS_BUTTON (button));

  g_signal_emit (button, button_signals[CLICKED], 0);
}
예제 #20
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
void
gtk_button_enter (GtkButton *button)
{
  g_return_if_fail (GTK_IS_BUTTON (button));

  g_signal_emit (button, button_signals[ENTER], 0);
}
예제 #21
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
void
gtk_button_pressed (GtkButton *button)
{
  g_return_if_fail (GTK_IS_BUTTON (button));

  g_signal_emit (button, button_signals[PRESSED], 0);
}
예제 #22
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
void
gtk_button_released (GtkButton *button)
{
  g_return_if_fail (GTK_IS_BUTTON (button));

  g_signal_emit (button, button_signals[RELEASED], 0);
}
예제 #23
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
/**
 * gtk_button_get_label:
 * @button: a #GtkButton
 *
 * Fetches the text from the label of the button, as set by
 * gtk_button_set_label(). If the label text has not 
 * been set the return value will be %NULL. This will be the 
 * case if you create an empty button with gtk_button_new() to 
 * use as a container.
 *
 * Return value: The text of the label widget. This string is owned
 * by the widget and must not be modified or freed.
 **/
G_CONST_RETURN gchar *
gtk_button_get_label (GtkButton *button)
{
  g_return_val_if_fail (GTK_IS_BUTTON (button), NULL);
  
  return button->label_text;
}
예제 #24
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
/**
 * gtk_button_get_use_stock:
 * @button: a #GtkButton
 *
 * Returns whether the button label is a stock item.
 *
 * Return value: %TRUE if the button label is used to
 *               select a stock item instead of being
 *               used directly as the label text.
 */
gboolean
gtk_button_get_use_stock (GtkButton *button)
{
  g_return_val_if_fail (GTK_IS_BUTTON (button), FALSE);
  
  return button->use_stock;
}
static GtkWidget *
get_event_widget (GtkWidget *proxy)
{
	GtkWidget *widget;

	/**
	 * Finding the interesting widget requires internal knowledge of
	 * the widgets in question. This can't be helped, but by keeping
	 * the sneaky code in one place, it can easily be updated.
	 */
	if (GTK_IS_MENU_ITEM (proxy)) {
		/* Menu items already forward middle clicks */
		widget = NULL;
	} else if (GTK_IS_MENU_TOOL_BUTTON (proxy)) {
		widget = eel_gtk_menu_tool_button_get_button (GTK_MENU_TOOL_BUTTON (proxy));
	} else if (GTK_IS_TOOL_BUTTON (proxy)) {
		/* The tool button's button is the direct child */
		widget = gtk_bin_get_child (GTK_BIN (proxy));
	} else if (GTK_IS_BUTTON (proxy)) {
		widget = proxy;
	} else {
		/* Don't touch anything we don't know about */
		widget = NULL;
	}

	return widget;
}
예제 #26
0
파일: grid.c 프로젝트: jtfrey/slurm
void _put_button_as_inactive(grid_button_t *grid_button)
{
	if (GTK_IS_BUTTON(grid_button->button)) {
		//gtk_widget_set_sensitive (grid_button->button, false);
		return;
	}
	gtk_widget_destroy(grid_button->button);
	grid_button->button = gtk_button_new();
	gtk_widget_set_size_request(grid_button->button,
				    working_sview_config.button_size,
				    working_sview_config.button_size);
	//gtk_widget_set_sensitive (grid_button->button, false);

	_add_button_signals(grid_button);

/* 	if (grid_button->frame) */
/* 		gtk_container_add(GTK_CONTAINER(grid_button->frame), */
/* 				  grid_button->button); */
	if (grid_button->table)
		gtk_table_attach(grid_button->table, grid_button->button,
				 grid_button->table_x,
				 (grid_button->table_x+1),
				 grid_button->table_y,
				 (grid_button->table_y+1),
				 GTK_SHRINK, GTK_SHRINK,
				 1, 1);
	gtk_widget_show_all(grid_button->button);
	return;
}
예제 #27
0
/**
 * hildon_app_menu_add_filter:
 * @menu : A #HildonAppMenu
 * @filter : A #GtkButton to add to the #HildonAppMenu.
 *
 * Adds the @filter to @menu.
 *
 * Since: 2.2
 */
void
hildon_app_menu_add_filter                      (HildonAppMenu *menu,
                                                 GtkButton *filter)
{
    HildonAppMenuPrivate *priv;

    g_return_if_fail (HILDON_IS_APP_MENU (menu));
    g_return_if_fail (GTK_IS_BUTTON (filter));

    priv = HILDON_APP_MENU_GET_PRIVATE(menu);

    /* Force widget size */
    hildon_gtk_widget_set_theme_size (GTK_WIDGET (filter),
                                      HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);

    /* Add the filter to the menu */
    g_object_ref_sink (filter);
    priv->filters = g_list_append (priv->filters, filter);
    if (GTK_WIDGET_VISIBLE (filter))
        hildon_app_menu_repack_filters (menu);

    /* Enable accelerators */
    g_signal_connect (filter, "can-activate-accel", G_CALLBACK (can_activate_accel), NULL);

    /* Close the menu when the button is clicked */
    g_signal_connect_swapped (filter, "clicked", G_CALLBACK (gtk_widget_hide), menu);
    g_signal_connect (filter, "notify::visible", G_CALLBACK (filter_visibility_changed), menu);

    /* Remove filter from list when it is destroyed */
    g_object_weak_ref (G_OBJECT (filter), (GWeakNotify) remove_item_from_list, &(priv->filters));
    g_object_weak_ref (G_OBJECT (filter), (GWeakNotify) emit_menu_changed, menu);

    g_signal_emit (menu, app_menu_signals[CHANGED], 0);
}
예제 #28
0
static void
connect_widget_signals (GtkWidget *proxy, EggEditableToolbar *etoolbar)
{
  if (GTK_IS_CONTAINER (proxy))
    {
       gtk_container_forall (GTK_CONTAINER (proxy),
			     (GtkCallback) connect_widget_signals,
			     (gpointer) etoolbar);
    }

  if (GTK_IS_TOOL_ITEM (proxy))
    {
      g_signal_connect_object (proxy, "drag_begin",
			       G_CALLBACK (drag_begin_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_end",
			       G_CALLBACK (drag_end_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_data_get",
			       G_CALLBACK (drag_data_get_cb),
			       etoolbar, 0);
      g_signal_connect_object (proxy, "drag_data_delete",
			       G_CALLBACK (drag_data_delete_cb),
			       etoolbar, 0);
    }

  if (GTK_IS_BUTTON (proxy) || GTK_IS_TOOL_ITEM (proxy))
    {
      g_signal_connect_object (proxy, "button-press-event",
			       G_CALLBACK (button_press_event_cb),
			       etoolbar, 0);
    }
}
예제 #29
0
파일: gtkbutton.c 프로젝트: zjx632/tinygtk
GtkReliefStyle
gtk_button_get_relief (GtkButton *button)
{
  g_return_val_if_fail (button != NULL, GTK_RELIEF_NORMAL);
  g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);

  return button->relief;
}
예제 #30
0
static void
xfce_about_help (GtkWidget *button,
                 GtkWidget *dialog)
{
  g_return_if_fail (GTK_IS_BUTTON (button));
  xfce_dialog_show_help (GTK_WINDOW (dialog),
                         NULL, NULL, NULL);
}