Пример #1
0
/**
 * gva_play_back_row_activated_cb:
 * @view: the "Recorded Games" tree view
 * @path: the #GtkTreePath for the activated row
 * @column: the #GtkTreeViewColumn in which the activation occurred
 *
 * Handler for #GtkTreeView::row-activated signals to the "Recorded Games"
 * tree view.
 *
 * Activates the #GVA_ACTION_PLAY_BACK action.
 **/
void
gva_play_back_row_activated_cb (GtkTreeView *view,
                                GtkTreePath *path,
                                GtkTreeViewColumn *column)
{
        gtk_action_activate (GVA_ACTION_PLAY_BACK);
}
Пример #2
0
static gboolean
caja_navigation_window_key_press_event (GtkWidget *widget,
                                        GdkEventKey *event)
{
    CajaNavigationWindow *window;
    int i;

    window = CAJA_NAVIGATION_WINDOW (widget);

    for (i = 0; i < G_N_ELEMENTS (extra_navigation_window_keybindings); i++)
    {
        if (extra_navigation_window_keybindings[i].keyval == event->keyval)
        {
            GtkAction *action;

            action = gtk_action_group_get_action (window->details->navigation_action_group,
                                                  extra_navigation_window_keybindings[i].action);

            g_assert (action != NULL);
            if (gtk_action_is_sensitive (action))
            {
                gtk_action_activate (action);
                return TRUE;
            }

            break;
        }
    }

    return GTK_WIDGET_CLASS (caja_navigation_window_parent_class)->key_press_event (widget, event);
}
Пример #3
0
static void
action_close_cb (GtkAction *action,
                 ESignatureEditor *editor)
{
	gboolean something_changed = FALSE;
	const gchar *original_name;
	const gchar *signature_name;

	original_name = editor->priv->original_name;
	signature_name = gtk_entry_get_text (GTK_ENTRY (editor->priv->entry));

	something_changed |= gtkhtml_editor_has_undo (GTKHTML_EDITOR (editor));
	something_changed |= (strcmp (signature_name, original_name) != 0);

	if (something_changed) {
		gint response;

		response = e_error_run (
			GTK_WINDOW (editor),
			"mail:ask-signature-changed", NULL);
		if (response == GTK_RESPONSE_YES) {
			GtkActionGroup *action_group;

			action_group = editor->priv->action_group;
			action = gtk_action_group_get_action (
				action_group, "save-and-close");
			gtk_action_activate (action);
			return;
		} else if (response == GTK_RESPONSE_CANCEL)
			return;
	}

	gtk_widget_destroy (GTK_WIDGET (editor));
}
Пример #4
0
static gboolean
shell_searchbar_entry_key_press_cb (EShellSearchbar *searchbar,
                                    GdkEventKey *key_event,
                                    GtkWindow *entry)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	GtkAction *action;
	guint mask;

	mask = gtk_accelerator_get_default_mod_mask ();
	if ((key_event->state & mask) != GDK_MOD1_MASK)
		return FALSE;

	if (key_event->keyval != GDK_KEY_Down)
		return FALSE;

	shell_view = e_shell_searchbar_get_shell_view (searchbar);
	shell_window = e_shell_view_get_shell_window (shell_view);

	action = E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS (shell_window);
	gtk_action_activate (action);

	return TRUE;
}
Пример #5
0
static void
browser_create (void)
{
    MidoriApp* app;
    MidoriBrowser* browser;
    GtkActionGroup* action_group;
    GList* actions;

    app = midori_app_new ();
    browser = midori_app_create_browser (app);
    gtk_widget_destroy (GTK_WIDGET (browser));

    app = midori_app_new ();
    browser = midori_app_create_browser (app);
    action_group = midori_browser_get_action_group (browser);
    actions = gtk_action_group_list_actions (action_group);
    while (actions)
    {
        GtkAction* action = actions->data;
        if (g_strcmp0 (gtk_action_get_name (action), "WindowClose"))
            if (g_strcmp0 (gtk_action_get_name (action), "EncodingCustom"))
                if (g_strcmp0 (gtk_action_get_name (action), "AddSpeedDial"))
                    gtk_action_activate (action);
        actions = g_list_next (actions);
    }
    g_list_free (actions);
    gtk_widget_destroy (GTK_WIDGET (browser));
    g_object_unref (app);
}
Пример #6
0
/**
 * Toggle blank mode FIXME bitfields!!!
 *
 */
void
toggle_blank (GtkAction* action, DenemoScriptParam *param)
{
  GtkAction *mode = gtk_ui_manager_get_action (Denemo.ui_manager, "/MainMenu/ModeMenu/Blank");
  gtk_action_activate (mode);
  displayhelper (Denemo.project);
  score_status(Denemo.project, TRUE);
}
Пример #7
0
static void tito_search(const gchar* sname, const gchar* slabel, const gchar* stooltip, GtkAction *saction)
{
	const gchar* keyword="gauss";
	
	if(strstr(sname,keyword))
		{
			g_message("%s %s",slabel,stooltip);
			gtk_action_activate(saction);
		}
/*		else if(strstr(stooltip,keyword))*/
/*		g_message("%s %s",slabel,stooltip);*/
}
static void
action_save_cb (GtkAction *action,
                EMsgComposer *composer)
{
	EHTMLEditor *editor;
	EHTMLEditorView *view;
	const gchar *filename;
	gint fd;
	GError *error = NULL;

	editor = e_msg_composer_get_editor (composer);
	filename = e_html_editor_get_filename (editor);
	if (filename == NULL) {
		gtk_action_activate (ACTION (SAVE_AS));
		return;
	}

	/* Check if the file already exists and we can create it. */
	fd = g_open (filename, O_RDONLY | O_CREAT | O_EXCL, 0777);
	if (fd < 0) {
		gint errno_saved = errno;

		if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
			gint response;

			response = e_alert_run_dialog_for_args (
				GTK_WINDOW (composer),
				E_ALERT_ASK_FILE_EXISTS_OVERWRITE,
				filename, NULL);
			if (response != GTK_RESPONSE_OK)
				return;
		} else {
			e_alert_submit (
				E_ALERT_SINK (composer),
				E_ALERT_NO_SAVE_FILE, filename,
				g_strerror (errno_saved), NULL);
			return;
		}
	} else
		close (fd);

	if (!e_html_editor_save (editor, filename, TRUE, &error)) {
		e_alert_submit (
			E_ALERT_SINK (composer),
			E_ALERT_NO_SAVE_FILE,
			filename, error->message, NULL);
		g_error_free (error);
		return;
	}

	view = e_html_editor_get_view (editor);
	e_html_editor_view_set_changed (view, TRUE);
}
Пример #9
0
 static gboolean mouse_scroll(GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 {
	if(query_3270_terminal_status() != LIB3270_STATUS_BLANK || event->direction < 0 || event->direction > G_N_ELEMENTS(action_scroll))
		return 0;

	Trace("Scroll: %d Action: %p",event->direction,action_scroll[event->direction]);

	if(action_scroll[event->direction])
		gtk_action_activate(action_scroll[event->direction]);

 	return 0;
 }
Пример #10
0
static void
button_clicked (GtkWidget     *widget,
		GtkToolButton *button)
{
  GtkAction *action;

  action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (button));
  
  if (action)
    gtk_action_activate (action);

  g_signal_emit_by_name (button, "clicked");
}
Пример #11
0
static gboolean
signature_editor_delete_event_cb (ESignatureEditor *editor,
                                  GdkEvent *event)
{
	GtkActionGroup *action_group;
	GtkAction *action;

	action_group = editor->priv->action_group;
	action = gtk_action_group_get_action (action_group, "close");
	gtk_action_activate (action);

	return TRUE;
}
Пример #12
0
static gboolean
gimp_controllers_event_mapped (GimpControllerInfo        *info,
                               GimpController            *controller,
                               const GimpControllerEvent *event,
                               const gchar               *action_name,
                               GimpControllerManager     *manager)
{
  GtkUIManager *ui_manager = GTK_UI_MANAGER (manager->ui_manager);
  GList        *list;

  for (list = gtk_ui_manager_get_action_groups (ui_manager);
       list;
       list = g_list_next (list))
    {
      GtkActionGroup *group = list->data;
      GtkAction      *action;

      action = gtk_action_group_get_action (group, action_name);

      if (action)
        {
          switch (event->type)
            {
            case GIMP_CONTROLLER_EVENT_VALUE:
              if (G_VALUE_HOLDS_DOUBLE (&event->value.value) &&
                  GIMP_IS_ENUM_ACTION (action)               &&
                  GIMP_ENUM_ACTION (action)->value_variable)
                {
                  gdouble value = g_value_get_double (&event->value.value);

                  gimp_enum_action_selected (GIMP_ENUM_ACTION (action),
                                             value * 1000);

                  break;
                }
              /* else fallthru */

            case GIMP_CONTROLLER_EVENT_TRIGGER:
            default:
              gtk_action_activate (action);
              break;
            }

          return TRUE;
        }
    }

  return FALSE;
}
Пример #13
0
static gboolean
state_set (GtkSwitch *sw, gboolean state)
{
  if (sw->priv->action_helper)
    gtk_action_helper_activate (sw->priv->action_helper);

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
  if (sw->priv->action)
    gtk_action_activate (sw->priv->action);
  G_GNUC_END_IGNORE_DEPRECATIONS;

  gtk_switch_set_state (sw, state);

  return TRUE;
}
Пример #14
0
static void
button_clicked (GtkWidget     *widget,
		GtkToolButton *button)
{
  GtkAction *action;

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;

  action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (button));
  
  if (action)
    gtk_action_activate (action);

  G_GNUC_END_IGNORE_DEPRECATIONS;

  g_signal_emit_by_name (button, "clicked");
}
Пример #15
0
static gboolean
view_key_press (GtkWidget   *widget,
                GdkEventKey *event)
{
  if (event->keyval == GDK_KEY_slash)
    {
      GtkAction *action;

      action = gtk_ui_manager_get_action (ui_manager,
                                          "/ui/help-browser-popup/find");
      gtk_action_activate (action);

      return TRUE;
    }

  return FALSE;
}
Пример #16
0
gboolean
gimp_ui_manager_activate_action (GimpUIManager *manager,
                                 const gchar   *group_name,
                                 const gchar   *action_name)
{
  GtkAction *action;

  g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), FALSE);
  g_return_val_if_fail (action_name != NULL, FALSE);

  action = gimp_ui_manager_find_action (manager, group_name, action_name);

  if (action)
    gtk_action_activate (action);

  return (action != NULL);
}
Пример #17
0
static gboolean
mail_shell_view_key_press_event_cb (EMailShellView *mail_shell_view,
                                    GdkEventKey *event)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	EShellContent *shell_content;
	EMailView *mail_view;
	EMailReader *reader;
	EMailDisplay *mail_display;
	GtkAction *action;

	shell_view = E_SHELL_VIEW (mail_shell_view);
	shell_window = e_shell_view_get_shell_window (shell_view);

	if ((event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)) != 0)
		return FALSE;

	shell_content = e_shell_view_get_shell_content (shell_view);
	mail_view = e_mail_shell_content_get_mail_view (E_MAIL_SHELL_CONTENT (shell_content));
	reader = E_MAIL_READER (mail_view);
	mail_display = e_mail_reader_get_mail_display (reader);

	switch (event->keyval) {
		case GDK_KEY_space:
			action = ACTION (MAIL_SMART_FORWARD);
			break;

		case GDK_KEY_BackSpace:
			action = ACTION (MAIL_SMART_BACKWARD);
			break;

		default:
			return FALSE;
	}

	if (e_web_view_get_need_input (E_WEB_VIEW (mail_display)) &&
	    gtk_widget_has_focus (GTK_WIDGET (mail_display)))
		return FALSE;

	gtk_action_activate (action);

	return TRUE;
}
Пример #18
0
static void
cb_selection_changed (GOComboPixmaps *combo, int id, GOActionComboPixmaps *paction)
{
	GSList *ptr;
	if (paction->updating_proxies)
		return;
	paction->selected_id = id;

	paction->updating_proxies = TRUE;
	ptr = gtk_action_get_proxies (GTK_ACTION (paction));
	for ( ; ptr != NULL ; ptr = ptr->next)
		if (GO_IS_COMBO_PIXMAPS (ptr->data) &&
		    go_combo_pixmaps_get_selected (ptr->data, NULL) != id)
			go_combo_pixmaps_select_id (ptr->data, id);
	paction->updating_proxies = FALSE;

	g_signal_emit_by_name (G_OBJECT (paction), "combo-activate");
	gtk_action_activate (GTK_ACTION (paction));
}
Пример #19
0
static void
shell_searchbar_entry_activate_cb (EShellSearchbar *searchbar)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	GtkAction *action;
	const gchar *search_text;

	shell_view = e_shell_searchbar_get_shell_view (searchbar);
	shell_window = e_shell_view_get_shell_window (shell_view);

	search_text = e_shell_searchbar_get_search_text (searchbar);
	if (search_text != NULL && *search_text != '\0')
		action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
	else
		action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);

	gtk_action_activate (action);
}
Пример #20
0
static void
shell_searchbar_entry_icon_release_cb (EShellSearchbar *searchbar,
                                       GtkEntryIconPosition icon_pos,
                                       GdkEvent *event)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	GtkAction *action;

	/* Clear the search when the icon is pressed and released. */

	if (icon_pos != GTK_ENTRY_ICON_SECONDARY)
		return;

	shell_view = e_shell_searchbar_get_shell_view (searchbar);
	shell_window = e_shell_view_get_shell_window (shell_view);

	action = E_SHELL_WINDOW_ACTION_SEARCH_CLEAR (shell_window);
	gtk_action_activate (action);
}
Пример #21
0
static void
shell_searchbar_entry_icon_press_cb (EShellSearchbar *searchbar,
                                     GtkEntryIconPosition icon_pos,
                                     GdkEvent *event)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	GtkAction *action;

	/* Show the search options menu when the icon is pressed. */

	if (icon_pos != GTK_ENTRY_ICON_PRIMARY)
		return;

	shell_view = e_shell_searchbar_get_shell_view (searchbar);
	shell_window = e_shell_view_get_shell_window (shell_view);

	action = E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS (shell_window);
	gtk_action_activate (action);
}
Пример #22
0
static void
gimp_editor_button_extended_clicked (GtkWidget       *button,
                                     GdkModifierType  mask,
                                     gpointer         data)
{
  GList *extended = g_object_get_data (G_OBJECT (button), "extended-actions");
  GList *list;

  for (list = extended; list; list = g_list_next (list))
    {
      ExtendedAction *ext = list->data;

      if ((ext->mod_mask & mask) == ext->mod_mask &&
          gtk_action_get_sensitive (ext->action))
        {
          gtk_action_activate (ext->action);
          break;
        }
    }
}
Пример #23
0
void
gimp_action_group_activate_action (GimpActionGroup *group,
                                   const gchar     *action_name)
{
  GtkAction *action;

  g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
  g_return_if_fail (action_name != NULL);

  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);

  if (! action)
    {
      g_warning ("%s: Unable to activate action which doesn't exist: %s",
                 G_STRFUNC, action_name);
      return;
    }

  gtk_action_activate (action);
}
Пример #24
0
/**
 * gtk_switch_set_active:
 * @sw: a #GtkSwitch
 * @is_active: %TRUE if @sw should be active, and %FALSE otherwise
 *
 * Changes the state of @sw to the desired one.
 *
 * Since: 3.0
 */
void
gtk_switch_set_active (GtkSwitch *sw,
                       gboolean   is_active)
{
  GtkSwitchPrivate *priv;

  g_return_if_fail (GTK_IS_SWITCH (sw));

  is_active = !!is_active;

  priv = sw->priv;

  if (priv->is_active != is_active)
    {
      AtkObject *accessible;
      GtkWidget *widget;
      GtkStyleContext *context;

      widget = GTK_WIDGET (sw);
      priv->is_active = is_active;

      g_object_notify_by_pspec (G_OBJECT (sw), switch_props[PROP_ACTIVE]);

      if (priv->action)
        gtk_action_activate (priv->action);

      accessible = gtk_widget_get_accessible (GTK_WIDGET (sw));
      atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, priv->is_active);

      if (gtk_widget_get_realized (widget))
        {
          context = gtk_widget_get_style_context (widget);
          gtk_style_context_notify_state_change (context,
                                                 gtk_widget_get_window (widget),
                                                 NULL, GTK_STATE_ACTIVE, is_active);
        }

      gtk_widget_queue_draw (GTK_WIDGET (sw));
    }
}
Пример #25
0
/**
 * gtk_switch_set_active:
 * @sw: a #GtkSwitch
 * @is_active: %TRUE if @sw should be active, and %FALSE otherwise
 *
 * Changes the state of @sw to the desired one.
 *
 * Since: 3.0
 */
void
gtk_switch_set_active (GtkSwitch *sw,
                       gboolean   is_active)
{
  GtkSwitchPrivate *priv;

  g_return_if_fail (GTK_IS_SWITCH (sw));

  is_active = !!is_active;

  priv = sw->priv;

  if (priv->is_active != is_active)
    {
      AtkObject *accessible;

      priv->is_active = is_active;

      g_object_notify_by_pspec (G_OBJECT (sw), switch_props[PROP_ACTIVE]);

      if (priv->action_helper)
        gtk_action_helper_activate (priv->action_helper);

      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
      if (priv->action)
        gtk_action_activate (priv->action);
      G_GNUC_END_IGNORE_DEPRECATIONS;

      accessible = gtk_widget_get_accessible (GTK_WIDGET (sw));
      atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, priv->is_active);

      if (priv->is_active)
        gtk_widget_set_state_flags (GTK_WIDGET (sw), GTK_STATE_FLAG_ACTIVE, FALSE);
      else
        gtk_widget_unset_state_flags (GTK_WIDGET (sw), GTK_STATE_FLAG_ACTIVE);

      gtk_widget_queue_draw (GTK_WIDGET (sw));
    }
}
Пример #26
0
static void
action_save_as_cb (GtkAction *action,
                   EMsgComposer *composer)
{
	EHTMLEditor *editor;
	GtkWidget *dialog;
	gchar *filename;
	gint response;

	dialog = gtk_file_chooser_dialog_new (
		_("Save as..."), GTK_WINDOW (composer),
		GTK_FILE_CHOOSER_ACTION_SAVE,
		_("_Cancel"), GTK_RESPONSE_CANCEL,
		_("_Save"), GTK_RESPONSE_OK,
		NULL);

	gtk_dialog_set_default_response (
		GTK_DIALOG (dialog), GTK_RESPONSE_OK);
	gtk_file_chooser_set_local_only (
		GTK_FILE_CHOOSER (dialog), FALSE);
	gtk_window_set_icon_name (
		GTK_WINDOW (dialog), "mail-message-new");

	response = gtk_dialog_run (GTK_DIALOG (dialog));

	if (response != GTK_RESPONSE_OK)
		goto exit;

	editor = e_msg_composer_get_editor (composer);
	filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
	e_html_editor_set_filename (editor, filename);
	g_free (filename);

	gtk_action_activate (ACTION (SAVE));

exit:
	gtk_widget_destroy (dialog);
}
Пример #27
0
static void
tools_activate_enum_action (const gchar *action_desc,
                            gint         value)
{
  gchar *group_name;
  gchar *action_name;

  group_name  = g_strdup (action_desc);
  action_name = strchr (group_name, '/');

  if (action_name)
    {
      GList     *managers;
      GtkAction *action;

      *action_name++ = '\0';

      managers = gimp_ui_managers_from_name ("<Image>");

      action = gimp_ui_manager_find_action (managers->data,
                                            group_name, action_name);

      if (GIMP_IS_ENUM_ACTION (action) &&
          GIMP_ENUM_ACTION (action)->value_variable)
        {
          gint old_value;

          old_value = GIMP_ENUM_ACTION (action)->value;
          GIMP_ENUM_ACTION (action)->value = value;
          gtk_action_activate (action);
          GIMP_ENUM_ACTION (action)->value = old_value;
        }
    }

  g_free (group_name);
}
Пример #28
0
static void
modify_button_hold(ModifyTool *tool, GdkEventButton *event,
		DDisplay *ddisp)
{
  Point clickedpoint;

  switch (tool->state) {
  case STATE_MOVE_OBJECT:
    /* A button hold is as if user was moving object - if it is
     * a text object and can be edited, then the move is cancelled */
    ddisplay_untransform_coords(ddisp,
				(int)event->x, (int)event->y,
				&clickedpoint.x, &clickedpoint.y);

    if (tool->object != NULL &&
	diagram_is_selected(ddisp->diagram, tool->object)) {
      if (textedit_activate_object(ddisp, tool->object, &clickedpoint)) {
	/* Return tool to normal state - object is text and is in edit */
	gdk_pointer_ungrab (event->time);
	tool->orig_pos = NULL;
	tool->state = STATE_NONE;
	/* Activate Text Edit */
	gtk_action_activate (menus_get_action ("ToolsTextedit"));
      }
    }
    break;
  case STATE_MOVE_HANDLE:
    break;
  case STATE_BOX_SELECT:
    break;
  case STATE_NONE:
    break;
  default:
    message_error("Internal error: Strange state in modify_tool (button_hold)\n");
  }
}
Пример #29
0
/*************
 * Callbacks *
 *************/
G_MODULE_EXPORT gboolean on_gui_key_press(GtkWidget *widget, GdkEventKey *event, AWeatherGui *self)
{
	g_debug("AWeatherGui: on_gui_key_press - key=%x, state=%x",
			event->keyval, event->state);
	GObject *action = aweather_gui_get_object(self, "fullscreen");
	gboolean full   = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
	if (event->keyval == GDK_KEY_q)
		gtk_widget_destroy(GTK_WIDGET(self));
	else if (event->keyval == GDK_KEY_F11 ||
	        (event->keyval == GDK_KEY_Escape && full))
		gtk_action_activate(GTK_ACTION(action));
	else if (event->keyval == GDK_KEY_r && event->state & GDK_CONTROL_MASK)
		grits_viewer_refresh(self->viewer);
	else if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) {
		GtkNotebook *tabs = GTK_NOTEBOOK(aweather_gui_get_widget(self, "main_tabs"));
		gint num_tabs = gtk_notebook_get_n_pages(tabs);
		gint cur_tab  = gtk_notebook_get_current_page(tabs);
		if (event->state & GDK_SHIFT_MASK)
			gtk_notebook_set_current_page(tabs, (cur_tab-1)%num_tabs);
		else
			gtk_notebook_set_current_page(tabs, (cur_tab+1)%num_tabs);
	};
	return FALSE;
}
Пример #30
0
void on_systrayIcon_activate(GtkObject *object, gpointer user_data)
{
  struct s_gui_data *gui_data = (struct s_gui_data *)user_data;
  gtk_action_activate(gui_data->action_toggleApplication);
}