Example #1
0
/*#
    @method activate GtkMenuItem
    @brief Emits the "activate" signal on the given item.
 */
FALCON_FUNC MenuItem::activate( VMARG )
{
    NO_ARGS
    MYSELF;
    GET_OBJ( self );
    gtk_menu_item_activate( (GtkMenuItem*)_obj );
}
Example #2
0
static void
sensor_disabled(IsManager *manager,
                IsSensor *sensor,
                IsIndicator *self)
{
  IsIndicatorPrivate *priv = self->priv;

  _sensor_disabled(sensor, self);

  if (priv->menu_items)
  {
    /* ignore if was not primary sensor, otherwise, get a new one */
    if (sensor != priv->primary)
    {
      goto out;
    }
    /* choose top-most menu item and set it as primary one */
    GtkWidget *menu_item = GTK_WIDGET(priv->menu_items->data);
    /* activate it to make this the new primary sensor */
    gtk_menu_item_activate(GTK_MENU_ITEM(menu_item));
  }
  else
  {
    is_indicator_set_label(self, _("No active sensors"));
#if !HAVE_APPINDICATOR
    gtk_status_icon_set_from_stock(GTK_STATUS_ICON(self),
                                   GTK_STOCK_DIALOG_WARNING);
#endif
    g_clear_object(&priv->primary);
  }
out:
  return;
}
Example #3
0
int
clip_GTK_MENUITEMACTIVATE(ClipMachine * ClipMachineMemory)
{
   C_widget *citm = _fetch_cw_arg(ClipMachineMemory);

   CHECKCWID(citm, GTK_IS_ITEM);
   gtk_menu_item_activate(GTK_MENU_ITEM(citm->widget));
   return 0;
 err:
   return 1;
}
Example #4
0
File: xqf-ui.c Project: IR4T4/xqf
GtkWidget *create_server_type_menu (int active_type,
		gboolean (*filterfunc)(enum server_type),
		GtkSignalFunc callback) {
	GtkWidget *option_menu = NULL;
	GtkWidget *menu = NULL;
	GtkWidget *menu_item = NULL;
	GtkWidget *first_menu_item = NULL;
	int i;
	int j = 0;
	int menu_type = 0;

	option_menu = gtk_option_menu_new ();

	menu = gtk_menu_new ();

	for (i = 0; i < GAMES_TOTAL; ++i) {
		if (filterfunc && !filterfunc (i))
			continue;

		menu_item = gtk_menu_item_new ();

		if (i == active_type) {
			first_menu_item = menu_item;
			menu_type = j;
		}
		else if (!first_menu_item)
			first_menu_item = menu_item;

		gtk_menu_append (GTK_MENU (menu), menu_item);

		gtk_container_add (GTK_CONTAINER (menu_item), game_pixmap_with_label (i));

		if (callback)
			gtk_signal_connect (GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (callback), GINT_TO_POINTER (i));

		gtk_widget_show (menu_item);

		++j; // must be here in case the continue was used
	}

	gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);

	// initiates callback to set servertype to first configured game
	if (active_type != -1 && first_menu_item) {
		gtk_menu_item_activate (GTK_MENU_ITEM (first_menu_item));
		gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), menu_type);
	}

	return option_menu;
}
Example #5
0
/**
 * gtk_check_menu_item_set_active:
 * @check_menu_item: a #GtkCheckMenuItem.
 * @is_active: boolean value indicating whether the check box is active.
 *
 * Sets the active state of the menu item's check box.
 */
void
gtk_check_menu_item_set_active (GtkCheckMenuItem *check_menu_item,
                                gboolean          is_active)
{
  GtkCheckMenuItemPrivate *priv;

  g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));

  priv = check_menu_item->priv;

  is_active = is_active != 0;

  if (priv->active != is_active)
    gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
}
Example #6
0
static void
from_activate(GtkWidget *widget, fromxsl_t *xsls)
{
	toxsl_t *to_f = xsls->xsls;
	
	from_deactivate(xsl_from);

	xsl_from = xsls;
	xsl_to = to_f;
	
	gtk_menu_item_activate(GTK_MENU_ITEM(to_f->item));
	while(to_f != NULL)
	{
		gtk_widget_set_sensitive(to_f->item, 1);
		to_f = to_f->next;
	}
}
Example #7
0
static void
on_view_row_activated (GtkTreeView       *view,
                       GtkTreePath       *path,
                       GtkTreeViewColumn *column,
                       gpointer           dummy)
{
  GtkTreeModel *model = gtk_tree_view_get_model (view);
  GtkTreeIter   iter;
  
  if (gtk_tree_model_get_iter (model, &iter, path)) {
    gint type;
    
    gtk_tree_model_get (model, &iter, COL_TYPE, &type, -1);
    
    switch (type) {
      case COL_TYPE_FILE: {
        GeanyDocument  *doc;
        gint            page;
        
        gtk_tree_model_get (model, &iter, COL_DOCUMENT, &doc, -1);
        page = document_get_notebook_page (doc);
        gtk_notebook_set_current_page (GTK_NOTEBOOK (geany_data->main_widgets->notebook),
                                       page);
        break;
      }
      
      case COL_TYPE_MENU_ITEM: {
        GtkMenuItem *item;
        
        gtk_tree_model_get (model, &iter, COL_WIDGET, &item, -1);
        gtk_menu_item_activate (item);
        g_object_unref (item);
        
        break;
      }
    }
    gtk_widget_hide (plugin_data.panel);
  }
}
Example #8
0
gboolean menuitem_activate_wrapper(gpointer data)
{
    gtk_menu_item_activate((GtkMenuItem*)data);
    return FALSE;
}
Example #9
0
static void
gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
{
  GtkRadioMenuItem *radio_menu_item = GTK_RADIO_MENU_ITEM (menu_item);
  GtkRadioMenuItemPrivate *priv = radio_menu_item->priv;
  GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
  GtkCheckMenuItem *tmp_menu_item;
  GtkAction        *action;
  GSList *tmp_list;
  gboolean active;
  gint toggled;

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;

  action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menu_item));
  if (action && gtk_menu_item_get_submenu (menu_item) == NULL)
    gtk_action_activate (action);

  G_GNUC_END_IGNORE_DEPRECATIONS;

  toggled = FALSE;

  active = gtk_check_menu_item_get_active (check_menu_item);
  if (active)
    {
      tmp_menu_item = NULL;
      tmp_list = priv->group;

      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

          if (gtk_check_menu_item_get_active (tmp_menu_item) &&
              tmp_menu_item != check_menu_item)
	    break;

	  tmp_menu_item = NULL;
	}

      if (tmp_menu_item)
	{
	  toggled = TRUE;
          _gtk_check_menu_item_set_active (check_menu_item, !active);
	}
    }
  else
    {
      toggled = TRUE;
      _gtk_check_menu_item_set_active (check_menu_item, !active);

      tmp_list = priv->group;
      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

          if (gtk_check_menu_item_get_active (tmp_menu_item) &&
              tmp_menu_item != check_menu_item)
	    {
              gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
	      break;
	    }
	}
    }

  if (toggled)
    {
      gtk_check_menu_item_toggled (check_menu_item);
    }

  gtk_widget_queue_draw (GTK_WIDGET (radio_menu_item));
}
Example #10
0
static VALUE
mitem_activate(VALUE self)
{
    gtk_menu_item_activate(_SELF(self));
    return self;
}
Example #11
0
void
on_xvc_warn_main_window_response (GtkDialog * dialog, gint response_id,
                                  gpointer user_data)
{
#undef DEBUGFUNCTION
#define DEBUGFUNCTION "on_xvc_warn_main_window_response()"
    GladeXML *xml = NULL;
    GtkWidget *mitem = NULL;

#ifdef DEBUG
    printf ("%s %s: Entering with response_id %i, called from %i\n",
            DEBUGFILE, DEBUGFUNCTION, response_id, called_from_where);
#endif     // DEBUG

    switch (response_id) {
    case GTK_RESPONSE_OK:

        if (warning_elist != NULL) {
            XVC_ErrorListItem *err;

            err = warning_elist;
            for (; err != NULL; err = err->next) {
                (*err->err->action) (err);
            }
        }

        warning_elist = xvc_errorlist_delete (warning_elist);

        switch (called_from_where) {
        case 0:
            gtk_widget_destroy (xvc_warn_main_window);
            xvc_pref_do_OK ();
            break;
#ifdef USE_FFMPEG
        case 1:
            gtk_widget_destroy (xvc_warn_main_window);
            xvc_toggle_cap_type ();
            break;
#endif     // USE_FFMPEG
        case 2:
            gtk_widget_destroy (xvc_warn_main_window);
            xvc_check_start_options ();
        }
        break;
    case GTK_RESPONSE_CANCEL:
        switch (called_from_where) {
        case 0:
            xvc_pref_reset_OK_attempts ();
            gtk_widget_destroy (xvc_warn_main_window);
            break;
#ifdef USE_FFMPEG
        case 1:
            xvc_undo_toggle_cap_type ();
            gtk_widget_destroy (xvc_warn_main_window);
            break;
#endif     // USE_FFMPEG
        }
        break;
    case GTK_RESPONSE_HELP:
        doHelp ();
        break;
    case GTK_RESPONSE_REJECT:
        xml = glade_get_widget_tree (xvc_ctrl_m1);
        g_assert (xml);
        mitem = glade_xml_get_widget (xml, "xvc_ctrl_m1_mitem_preferences");
        g_assert (mitem);
        gtk_menu_item_activate (GTK_MENU_ITEM (mitem));

        xml = NULL;
        xml = glade_get_widget_tree (xvc_pref_main_window);
        g_assert (xml);
        mitem = glade_xml_get_widget (xml, "xvc_pref_cancel_button");
        g_assert (mitem);
        gtk_widget_set_sensitive (GTK_WIDGET (mitem), FALSE);

        warning_elist = xvc_errorlist_delete (warning_elist);
        xvc_pref_reset_OK_attempts ();

        gtk_widget_destroy (xvc_warn_main_window);
        break;
    default:
        break;
    }

#ifdef DEBUG
    printf ("%s %s: Leaving\n", DEBUGFILE, DEBUGFUNCTION);
#endif     // DEBUG
}
Example #12
0
static GtkWidget *country_stats_page (void) {
	GtkWidget *page_vbox;
	GtkWidget *option_menu;
	GtkWidget *hbox;
	int pagenum = 0;
	enum server_type type = Q2_SERVER;
	enum server_type to_activate = UNKNOWN_SERVER;

	page_vbox = gtk_vbox_new (FALSE, 4);
	gtk_container_set_border_width (GTK_CONTAINER (page_vbox), 8);

	country_notebook = gtk_notebook_new ();
	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (country_notebook), FALSE);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (country_notebook), GTK_POS_TOP);
	gtk_notebook_set_tab_hborder (GTK_NOTEBOOK (country_notebook), 4);
	gtk_notebook_set_show_border(GTK_NOTEBOOK(country_notebook), FALSE);

	selected_country = to_activate = config_get_int("/" CONFIG_FILE "/Statistics/country");

	for (type = 0; type <= GAMES_TOTAL; ++type) {
		if (!srv_countries[type].nonzero)
			continue;

		srv_countries[type].notebookpage=pagenum++;

		country_notebook_page (country_notebook, type, &srv_countries[type]);
	}

	// the notebook must exist to allow activate events of the menu
	hbox = gtk_hbox_new(FALSE,0);
	gtk_box_pack_start (GTK_BOX (page_vbox), hbox, FALSE, TRUE, 0);

	option_menu = create_server_type_menu (to_activate==GAMES_TOTAL?-1:to_activate,
			create_server_type_menu_filter_hascountries,
			GTK_SIGNAL_FUNC(select_country_server_type_callback));
	{
		GtkWidget* menu_item = gtk_menu_item_new ();
		GtkWidget* label = gtk_label_new(_("All Games"));
		GtkWidget* menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(option_menu));

		// separator
		gtk_widget_set_sensitive (menu_item, FALSE);
		gtk_menu_prepend (GTK_MENU (menu), menu_item);
		gtk_widget_show (menu_item);

		menu_item = gtk_menu_item_new ();
		gtk_menu_prepend (GTK_MENU (menu), menu_item);
		gtk_container_add (GTK_CONTAINER (menu_item), label);

		gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
				GTK_SIGNAL_FUNC (select_country_server_type_callback), (gpointer)GAMES_TOTAL);

		gtk_widget_show (menu_item);
		gtk_widget_show (label);

		if (to_activate == GAMES_TOTAL) {
			gtk_menu_item_activate (GTK_MENU_ITEM (menu_item)); 
			gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 0);
		}
	}

	gtk_box_pack_start (GTK_BOX (hbox), option_menu, TRUE, FALSE, 0);
	gtk_widget_show (option_menu);

	gtk_widget_show(hbox);

	gtk_box_pack_start (GTK_BOX (page_vbox), country_notebook, TRUE, TRUE, 0);

	gtk_widget_show (country_notebook);
	gtk_widget_show (page_vbox);

	return page_vbox;
}
Example #13
0
void
sheets_optionmenu_create(GtkWidget *option_menu, GtkWidget *wrapbox,
                         gchar *sheet_name)
{
  GtkWidget *optionmenu_menu;
  GSList *sheets_list;
  GList *menu_item_list;

  /* Delete the contents, if any, of this optionemnu first */

  optionmenu_menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(option_menu));
  gtk_container_foreach(GTK_CONTAINER(optionmenu_menu),
                        (GtkCallback)gtk_widget_destroy, NULL);

  for (sheets_list = sheets_mods_list; sheets_list;
       sheets_list = g_slist_next(sheets_list))
  {
    SheetMod *sheet_mod;
    GtkWidget *menu_item;
    gchar *tip;

    sheet_mod = sheets_list->data;

    /* We don't display sheets which have been deleted prior to Apply */

    if (sheet_mod->mod == SHEETMOD_MOD_DELETED)
      continue;

    {
      menu_item = gtk_menu_item_new_with_label(gettext(sheet_mod->sheet.name));

      gtk_menu_append(GTK_MENU(optionmenu_menu), menu_item);
      
      if (sheet_mod->sheet.scope == SHEET_SCOPE_SYSTEM)
	tip = g_strdup_printf(_("%s\nSystem sheet"), sheet_mod->sheet.description);
      else
	tip = g_strdup_printf(_("%s\nUser sheet"), sheet_mod->sheet.description);
      
      gtk_widget_set_tooltip_text(menu_item, tip);
      g_free(tip);
    }

    gtk_widget_show(menu_item);

    g_object_set_data(G_OBJECT(menu_item), "wrapbox", wrapbox);

    g_signal_connect(G_OBJECT(menu_item), "activate",
		     G_CALLBACK(on_sheets_dialog_optionmenu_activate),
                       (gpointer)sheet_mod);
  }
 
  menu_item_list = gtk_container_get_children(GTK_CONTAINER(optionmenu_menu));

  /* If we were passed a sheet_name, then make the optionmenu point to that
     name after creation */

  if (sheet_name)
  {
    gint index = 0;
    GList *list;

    list = g_list_find_custom(menu_item_list, sheet_name,
                              menu_item_compare_labels);
    if (list)
      index = g_list_position(menu_item_list, list);
    gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), index);
    gtk_menu_item_activate(GTK_MENU_ITEM(g_list_nth_data(menu_item_list,
                                                         index)));
  }
  else
  {
    gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), 0);
    gtk_menu_item_activate(GTK_MENU_ITEM(menu_item_list->data));
  }

  g_list_free(menu_item_list);
}
Example #14
0
void mute_widget_toggle (MuteWidget *self)
{
  g_return_if_fail (self);
  MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
  gtk_menu_item_activate (priv->gitem);
}
Example #15
0
static OSStatus
menu_event_handler_func (EventHandlerCallRef  event_handler_call_ref,
			 EventRef             event_ref,
			 void                *data)
{
  UInt32  event_class = GetEventClass (event_ref);
  UInt32  event_kind = GetEventKind (event_ref);
  MenuRef menu_ref;

  switch (event_class)
    {
    case kEventClassCommand:
      /* This is called when activating (is that the right GTK+ term?)
       * a menu item.
       */
      if (event_kind == kEventCommandProcess)
	{
	  HICommand command;
	  OSStatus  err;

	  /*g_printerr ("Menu: kEventClassCommand/kEventCommandProcess\n");*/

	  err = GetEventParameter (event_ref, kEventParamDirectObject,
				   typeHICommand, 0,
				   sizeof (command), 0, &command);

	  if (err == noErr)
	    {
	      GtkWidget *widget = NULL;

	      /* Get any GtkWidget associated with the item. */
	      err = GetMenuItemProperty (command.menu.menuRef,
					 command.menu.menuItemIndex,
					 IGE_QUARTZ_MENU_CREATOR,
					 IGE_QUARTZ_ITEM_WIDGET,
					 sizeof (widget), 0, &widget);
	      if (err == noErr && GTK_IS_WIDGET (widget))
		{
		  gtk_menu_item_activate (GTK_MENU_ITEM (widget));
		  return noErr;
		}
	    }
	}
      break;

    case kEventClassMenu:
      GetEventParameter (event_ref,
			 kEventParamDirectObject,
			 typeMenuRef,
			 NULL,
			 sizeof (menu_ref),
			 NULL,
			 &menu_ref);

      switch (event_kind)
	{
	case kEventMenuTargetItem:
	  /* This is called when an item is selected (what is the
	   * GTK+ term? prelight?)
	   */
	  /*g_printerr ("kEventClassMenu/kEventMenuTargetItem\n");*/
	  break;

	case kEventMenuOpening:
	  /* Is it possible to dynamically build the menu here? We
	   * can at least set visibility/sensitivity.
	   */
	  /*g_printerr ("kEventClassMenu/kEventMenuOpening\n");*/
	  break;

	case kEventMenuClosed:
	  /*g_printerr ("kEventClassMenu/kEventMenuClosed\n");*/
	  break;

	default:
	  break;
	}

      break;

    default:
      break;
    }

  return CallNextEventHandler (event_handler_call_ref, event_ref);
}
Example #16
0
static void
gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
{
  GtkRadioMenuItem *radio_menu_item;
  GtkCheckMenuItem *check_menu_item;
  GtkCheckMenuItem *tmp_menu_item;
  GSList *tmp_list;
  gint toggled;

  g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (menu_item));

  radio_menu_item = GTK_RADIO_MENU_ITEM (menu_item);
  check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
  toggled = FALSE;

  if (check_menu_item->active)
    {
      tmp_menu_item = NULL;
      tmp_list = radio_menu_item->group;

      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    break;

	  tmp_menu_item = NULL;
	}

      if (tmp_menu_item)
	{
	  toggled = TRUE;
	  check_menu_item->active = !check_menu_item->active;
	}
    }
  else
    {
      toggled = TRUE;
      check_menu_item->active = !check_menu_item->active;

      tmp_list = radio_menu_item->group;
      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    {
	      gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
	      break;
	    }
	}
    }

  if (toggled)
    gtk_check_menu_item_toggled (check_menu_item);

  gtk_widget_queue_draw (GTK_WIDGET (radio_menu_item));
}
Example #17
0
static void
gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
{
  GtkRadioMenuItem *radio_menu_item = GTK_RADIO_MENU_ITEM (menu_item);
  GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
  GtkCheckMenuItem *tmp_menu_item;
  GtkAction        *action;
  GSList *tmp_list;
  gint toggled;

  action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (menu_item));
  if (action && gtk_menu_item_get_submenu (menu_item) == NULL)
    gtk_action_activate (action);

  toggled = FALSE;

  if (check_menu_item->active)
    {
      tmp_menu_item = NULL;
      tmp_list = radio_menu_item->group;

      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    break;

	  tmp_menu_item = NULL;
	}

      if (tmp_menu_item)
	{
	  toggled = TRUE;
	  check_menu_item->active = !check_menu_item->active;
	}
    }
  else
    {
      toggled = TRUE;
      check_menu_item->active = !check_menu_item->active;

      tmp_list = radio_menu_item->group;
      while (tmp_list)
	{
	  tmp_menu_item = tmp_list->data;
	  tmp_list = tmp_list->next;

	  if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
	    {
	      gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
	      break;
	    }
	}
    }

  if (toggled)
    {
      gtk_check_menu_item_toggled (check_menu_item);
    }

  gtk_widget_queue_draw (GTK_WIDGET (radio_menu_item));
}
Example #18
0
void GtkMenuItem_::activate()
{
	gtk_menu_item_activate (GTK_MENU_ITEM(instance));

}
static void
xfapplet_menu_item_activated (MateComponentUIComponent *uic, gpointer mi, const char *cname)
{
	gtk_menu_item_activate (GTK_MENU_ITEM(mi));
}