Ejemplo n.º 1
0
/**
 * gtk_action_set_stock_id:
 * @action: a #GtkAction
 * @stock_id: the stock id
 *
 * Sets the stock id on @action
 *
 * Since: 2.16
 */
void 
gtk_action_set_stock_id (GtkAction   *action,
			 const gchar *stock_id)
{
  gchar *tmp;

  g_return_if_fail (GTK_IS_ACTION (action));

  g_return_if_fail (GTK_IS_ACTION (action));

  tmp = action->private_data->stock_id;
  action->private_data->stock_id = g_strdup (stock_id);
  g_free (tmp);

  g_object_notify (G_OBJECT (action), "stock-id");
  
  /* update label and short_label if appropriate */
  if (!action->private_data->label_set)
    {
      GtkStockItem stock_item;
      
      if (action->private_data->stock_id &&
	  gtk_stock_lookup (action->private_data->stock_id, &stock_item))
	gtk_action_set_label (action, stock_item.label);
      else 
	gtk_action_set_label (action, NULL);
      
      action->private_data->label_set = FALSE;
    }
}
Ejemplo n.º 2
0
/**
 * xviewer_properties_dialog_new:
 * @parent: 
 * @thumbview: 
 * @next_image_action: 
 * @previous_image_action: 
 *
 * 
 *
 * Returns: (transfer full) (type XviewerPropertiesDialog): a new #XviewerPropertiesDialog
 **/
GtkWidget *
xviewer_properties_dialog_new (GtkWindow    *parent,
			   XviewerThumbView *thumbview,
			   GtkAction    *next_image_action,
			   GtkAction    *previous_image_action)
{
	GObject *prop_dlg;

	g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
	g_return_val_if_fail (XVIEWER_IS_THUMB_VIEW (thumbview), NULL);
	g_return_val_if_fail (GTK_IS_ACTION (next_image_action), NULL);
	g_return_val_if_fail (GTK_IS_ACTION (previous_image_action), NULL);

	prop_dlg = g_object_new (XVIEWER_TYPE_PROPERTIES_DIALOG,
			     	 "thumbview", thumbview,
				 "next-action", next_image_action,
				 "prev-action", previous_image_action,
			     	 NULL);

	if (parent) {
		gtk_window_set_transient_for (GTK_WINDOW (prop_dlg), parent);
	}

	return GTK_WIDGET (prop_dlg);
}
Ejemplo n.º 3
0
/**
 * gtk_action_set_label:
 * @action: a #GtkAction
 * @label: the label text to set
 *
 * Sets the label of @action.
 *
 * Since: 2.16
 */
void 
gtk_action_set_label (GtkAction	  *action,
		      const gchar *label)
{
  gchar *tmp;
  
  g_return_if_fail (GTK_IS_ACTION (action));
  
  tmp = action->private_data->label;
  action->private_data->label = g_strdup (label);
  g_free (tmp);
  action->private_data->label_set = (action->private_data->label != NULL);
  /* if label is unset, then use the label from the stock item */
  if (!action->private_data->label_set && action->private_data->stock_id)
    {
      GtkStockItem stock_item;
      
      if (gtk_stock_lookup (action->private_data->stock_id, &stock_item))
	action->private_data->label = g_strdup (stock_item.label);
    }

  g_object_notify (G_OBJECT (action), "label");
  
  /* if short_label is unset, set short_label=label */
  if (!action->private_data->short_label_set)
    {
      gtk_action_set_short_label (action, action->private_data->label);
      action->private_data->short_label_set = FALSE;
    }
}
Ejemplo n.º 4
0
/**
 * gtk_action_get_always_show_image:
 * @action: a #GtkAction
 *
 * Returns whether @action<!-- -->'s menu item proxies will ignore the
 * #GtkSettings:gtk-menu-images setting and always show their image,
 * if available.
 *
 * Returns: %TRUE if the menu item proxies will always show their image
 *
 * Since: 2.20
 */
gboolean
gtk_action_get_always_show_image  (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);

  return action->private_data->always_show_image;
}
Ejemplo n.º 5
0
/**
 * gtk_action_get_is_important:
 * @action: a #GtkAction
 *
 * Checks whether @action is important or not
 * 
 * Returns: whether @action is important
 *
 * Since: 2.16
 */
gboolean 
gtk_action_get_is_important (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);

  return action->private_data->is_important;
}
Ejemplo n.º 6
0
/**
 * gtk_action_get_sensitive:
 * @action: the action object
 * 
 * Returns whether the action itself is sensitive. Note that this doesn't 
 * necessarily mean effective sensitivity. See gtk_action_is_sensitive() 
 * for that.
 *
 * Return value: %TRUE if the action itself is sensitive.
 *
 * Since: 2.4
 **/
gboolean
gtk_action_get_sensitive (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);

  return action->private_data->sensitive;
}
Ejemplo n.º 7
0
static void
on_key_import_keyring (GtkAction* action, SeahorseCatalog* self)
{
	GCancellable *cancellable;
	SeahorsePgpBackend *backend;
	SeahorseGpgmeKeyring *keyring;
	GList* objects;

	g_return_if_fail (SEAHORSE_IS_CATALOG (self));
	g_return_if_fail (GTK_IS_ACTION (action));

	objects = seahorse_catalog_get_selected_objects (self);
	objects = objects_prune_non_exportable (objects);

	/* No objects, nothing to do */
	if (objects == NULL)
		return;

	cancellable = g_cancellable_new ();
	backend = seahorse_pgp_backend_get ();
	keyring = seahorse_pgp_backend_get_default_keyring (NULL);
	seahorse_pgp_backend_transfer_async (backend, objects, SEAHORSE_PLACE (keyring),
	                                     cancellable, on_import_complete, g_object_ref (self));
	seahorse_progress_show (cancellable, _ ("Importing keys from key servers"), TRUE);
	g_object_unref (cancellable);

	g_list_free (objects);
}
Ejemplo n.º 8
0
/**
 * gtk_action_get_short_label:
 * @action: a #GtkAction
 *
 * Gets the short label text of @action.
 *
 * Returns: the short label text.
 *
 * Since: 2.16
 */
const gchar *
gtk_action_get_short_label (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  return action->private_data->short_label;
}
Ejemplo n.º 9
0
static void 
on_remote_find (GtkAction* action, SeahorseKeyserverResults* self) 
{
	g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
	g_return_if_fail (GTK_IS_ACTION (action));
	seahorse_keyserver_search_show (seahorse_viewer_get_window (SEAHORSE_VIEWER (self)));
}
Ejemplo n.º 10
0
void
gl_ui_cmd_file_print (GtkAction *action,
                      glWindow  *window)
{
        glPrintOpDialog         *op;
        GtkPrintOperationResult  result;

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        op = gl_print_op_dialog_new (GL_VIEW(window->view)->label);

        if (window->print_settings)
        {
                gl_print_op_set_settings (GL_PRINT_OP (op), window->print_settings);
        }

        result = gtk_print_operation_run (GTK_PRINT_OPERATION (op),
                                          GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                          GTK_WINDOW (window),
                                          NULL);

        if ( result == GTK_PRINT_OPERATION_RESULT_APPLY )
        {
                gl_print_op_free_settings (window->print_settings);
                window->print_settings = gl_print_op_get_settings (GL_PRINT_OP (op));
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
Ejemplo n.º 11
0
void
gl_ui_cmd_objects_merge_properties (GtkAction *action,
                                    glWindow  *window)

{
        gl_debug (DEBUG_COMMANDS, "START");
        
        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (window->merge_dialog) {

                gtk_window_present (GTK_WINDOW(window->merge_dialog));
                gtk_window_set_transient_for (GTK_WINDOW (window->merge_dialog),
                                              GTK_WINDOW (window));

        } else {

                window->merge_dialog =
                        g_object_ref (
                                gl_merge_properties_dialog_new (GL_VIEW(window->view)->label,
                                                                GTK_WINDOW(window)) );

                g_signal_connect (G_OBJECT(window->merge_dialog), "destroy",
                                  G_CALLBACK (gtk_widget_destroyed),
                                  &window->merge_dialog);

                gtk_widget_show (GTK_WIDGET (window->merge_dialog));

        }

        gl_debug (DEBUG_COMMANDS, "END");
}
Ejemplo n.º 12
0
/**
 * gtk_action_get_proxies:
 * @action: the action object
 * 
 * Returns the proxy widgets for an action.
 * See also gtk_activatable_get_related_action().
 *
 * Return value: (element-type GtkWidget) (transfer none): a #GSList of proxy widgets. The list is owned by GTK+
 * and must not be modified.
 *
 * Since: 2.4
 **/
GSList*
gtk_action_get_proxies (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  return action->private_data->proxies;
}
Ejemplo n.º 13
0
/**
 * gtk_action_get_name:
 * @action: the action object
 * 
 * Returns the name of the action.
 * 
 * Return value: the name of the action. The string belongs to GTK+ and should not
 *   be freed.
 *
 * Since: 2.4
 **/
const gchar *
gtk_action_get_name (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  return action->private_data->name;
}
Ejemplo n.º 14
0
/**
 * gtk_action_unblock_activate:
 * @action: a #GtkAction
 *
 * Reenable activation signals from the action 
 *
 * Since: 2.16
 */
void
gtk_action_unblock_activate (GtkAction *action)
{
  g_return_if_fail (GTK_IS_ACTION (action));

  action->private_data->activate_blocked = FALSE;
}
Ejemplo n.º 15
0
/**
 * gtk_action_get_visible_vertical:
 * @action: a #GtkAction
 *
 * Checks whether @action is visible when horizontal
 * 
 * Returns: whether @action is visible when horizontal
 *
 * Since: 2.16
 */
gboolean 
gtk_action_get_visible_vertical (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);

  return action->private_data->visible_vertical;
}
Ejemplo n.º 16
0
void
gl_ui_cmd_edit_preferences (GtkAction *action,
                            glWindow  *window)
{
        static GtkWidget *dialog = NULL;

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        if (dialog != NULL)
        {
                gtk_window_present (GTK_WINDOW (dialog));
                gtk_window_set_transient_for (GTK_WINDOW (dialog),        
                                              GTK_WINDOW(window));

        } else {
                
                dialog = gl_prefs_dialog_new (GTK_WINDOW(window));

                g_signal_connect (G_OBJECT (dialog), "destroy",
                                  G_CALLBACK (gtk_widget_destroyed), &dialog);
        
                gtk_widget_show (dialog);

        }

        gl_debug (DEBUG_COMMANDS, "END");
}
Ejemplo n.º 17
0
/**
 * _gtk_action_sync_menu_visible:
 * @action: (allow-none): a #GtkAction, or %NULL to determine the action from @proxy
 * @proxy: a proxy menu item
 * @empty: whether the submenu attached to @proxy is empty
 * 
 * Updates the visibility of @proxy from the visibility of @action
 * according to the following rules:
 * <itemizedlist>
 * <listitem><para>if @action is invisible, @proxy is too
 * </para></listitem>
 * <listitem><para>if @empty is %TRUE, hide @proxy unless the "hide-if-empty" 
 *   property of @action indicates otherwise
 * </para></listitem>
 * </itemizedlist>
 * 
 * This function is used in the implementation of #GtkUIManager.
 **/
void
_gtk_action_sync_menu_visible (GtkAction *action,
			       GtkWidget *proxy,
			       gboolean   empty)
{
  gboolean visible = TRUE;
  gboolean hide_if_empty = TRUE;

  g_return_if_fail (GTK_IS_MENU_ITEM (proxy));
  g_return_if_fail (action == NULL || GTK_IS_ACTION (action));

  if (action == NULL)
    action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy));

  if (action)
    {
      /* a GtkMenu for a <popup/> doesn't have to have an action */
      visible = gtk_action_is_visible (action);
      hide_if_empty = action->private_data->hide_if_empty;
    }

  if (visible && !(empty && hide_if_empty))
    gtk_widget_show (proxy);
  else
    gtk_widget_hide (proxy);
}
Ejemplo n.º 18
0
static void 
on_view_collapse_all (GtkAction* action, SeahorseKeyserverResults* self) 
{
	g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
	g_return_if_fail (GTK_IS_ACTION (action));
	gtk_tree_view_collapse_all (self->pv->view);
}
Ejemplo n.º 19
0
/**
 * gtk_action_get_gicon:
 * @action: a #GtkAction
 *
 * Gets the gicon of @action.
 *
 * Returns: (transfer none): The action's #GIcon if one is set.
 *
 * Since: 2.16
 */
GIcon *
gtk_action_get_gicon (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  return action->private_data->gicon;
}
Ejemplo n.º 20
0
static void 
on_app_close (GtkAction* action, SeahorseKeyserverResults* self) 
{
	g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
	g_return_if_fail (action == NULL || GTK_IS_ACTION (action));
	seahorse_widget_destroy (SEAHORSE_WIDGET (self));
}
Ejemplo n.º 21
0
void 
gl_ui_cmd_help_contents (GtkAction *action,
                         glWindow  *window)
{
        GError *error = NULL;

        gl_debug (DEBUG_COMMANDS, "START");

        g_return_if_fail (action && GTK_IS_ACTION(action));
        g_return_if_fail (window && GL_IS_WINDOW(window));

        gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (window)),
                      "ghelp:glabels-3.0",
                      gtk_get_current_event_time(),
                      &error);
        
        if (error != NULL)
        {
                g_message ("%s", error->message);

                g_error_free (error);
        }

        gl_debug (DEBUG_COMMANDS, "END");
}
Ejemplo n.º 22
0
/**
 * gtk_action_get_accel_closure:
 * @action: the action object
 *
 * Returns the accel closure for this action.
 *
 * Since: 2.8
 *
 * Returns: (transfer none): the accel closure for this action. The
 *          returned closure is owned by GTK+ and must not be unreffed
 *          or modified.
 */
GClosure *
gtk_action_get_accel_closure (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  return action->private_data->accel_closure;
}
Ejemplo n.º 23
0
void
gnac_ui_utils_set_action_visible(GtkBuilder  *builder,
                                 const gchar *action_name,
                                 gboolean     visible)
{
  GtkAction *action = gnac_ui_utils_get_action(builder, action_name);
  if (GTK_IS_ACTION(action)) gtk_action_set_visible(action, visible);
}
Ejemplo n.º 24
0
/**
 * gtk_action_set_accel_path:
 * @action: the action object
 * @accel_path: the accelerator path
 *
 * Sets the accel path for this action.  All proxy widgets associated
 * with the action will have this accel path, so that their
 * accelerators are consistent.
 *
 * Note that @accel_path string will be stored in a #GQuark. Therefore, if you
 * pass a static string, you can save some memory by interning it first with 
 * g_intern_static_string().
 *
 * Since: 2.4
 */
void
gtk_action_set_accel_path (GtkAction   *action, 
			   const gchar *accel_path)
{
  g_return_if_fail (GTK_IS_ACTION (action));

  action->private_data->accel_quark = g_quark_from_string (accel_path);
}
Ejemplo n.º 25
0
/**
 * gtk_action_set_visible_vertical:
 * @action: a #GtkAction
 * @visible_vertical: whether the action is visible vertically
 *
 * Sets whether @action is visible when vertical 
 *
 * Since: 2.16
 */
void 
gtk_action_set_visible_vertical (GtkAction *action,
				 gboolean   visible_vertical)
{
  g_return_if_fail (GTK_IS_ACTION (action));

  g_return_if_fail (GTK_IS_ACTION (action));

  visible_vertical = visible_vertical != FALSE;
  
  if (action->private_data->visible_vertical != visible_vertical)
    {
      action->private_data->visible_vertical = visible_vertical;
      
      g_object_notify (G_OBJECT (action), "visible-vertical");
    }  
}
Ejemplo n.º 26
0
void
_gtk_action_remove_from_proxy_list (GtkAction     *action,
				    GtkWidget     *proxy)
{
  g_return_if_fail (GTK_IS_ACTION (action));
  g_return_if_fail (GTK_IS_WIDGET (proxy));

  GTK_ACTION_GET_CLASS (action)->disconnect_proxy (action, proxy);
}
Ejemplo n.º 27
0
/** The user has selected one of the items added by this plugin.
 *  Invoke the callback function that was registered along with the
 *  menu item.
 *
 *  @param action A pointer to the action selected by the user.  This
 *  action represents one of the items in the file history menu.
 *
 *  @param data A pointer to the gnc-main-window data to be used by
 *  this function.  This is mainly to find out which window it was
 *  that had a menu selected.
 */
static void
gnc_plugin_menu_additions_action_cb (GtkAction *action,
                                     GncMainWindowActionData *data)
{

    g_return_if_fail(GTK_IS_ACTION(action));
    g_return_if_fail(data != NULL);

    gnc_extension_invoke_cb(data->data, gnc_main_window_to_scm(data->window));
}
Ejemplo n.º 28
0
/**
 * gtk_action_create_menu:
 * @action: a #GtkAction
 *
 * If @action provides a #GtkMenu widget as a submenu for the menu
 * item or the toolbar item it creates, this function returns an
 * instance of that menu.
 *
 * Return value: (transfer none): the menu item provided by the
 *               action, or %NULL.
 *
 * Since: 2.12
 */
GtkWidget *
gtk_action_create_menu (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  if (GTK_ACTION_GET_CLASS (action)->create_menu)
    return GTK_ACTION_GET_CLASS (action)->create_menu (action);

  return NULL;
}
Ejemplo n.º 29
0
/**
 * gtk_action_get_accel_path:
 * @action: the action object
 *
 * Returns the accel path for this action.  
 *
 * Since: 2.6
 *
 * Returns: the accel path for this action, or %NULL
 *   if none is set. The returned string is owned by GTK+ 
 *   and must not be freed or modified.
 */
const gchar *
gtk_action_get_accel_path (GtkAction *action)
{
  g_return_val_if_fail (GTK_IS_ACTION (action), NULL);

  if (action->private_data->accel_quark)
    return g_quark_to_string (action->private_data->accel_quark);
  else
    return NULL;
}
static void
thunar_history_action_forward (GtkAction     *action,
                               ThunarHistory *history)
{
  _thunar_return_if_fail (GTK_IS_ACTION (action));
  _thunar_return_if_fail (THUNAR_IS_HISTORY (history));

  /* go forward one step */
  thunar_history_go_forward (history, 1);
}