Esempio n. 1
0
static void
vinagre_bookmarks_tree_row_activated_cb (GtkTreeView          *treeview,
					 GtkTreePath          *path,
					 GtkTreeViewColumn    *column,
					 VinagreBookmarksTree *tree)
{
  GtkTreeIter   iter;
  GtkTreeModel *model;
  GtkWidget    *toplevel;

  model = gtk_tree_view_get_model (treeview);

  gtk_tree_model_get_iter (model, &iter, path);
  if (gtk_tree_model_iter_has_child (model, &iter))
    {
      if (gtk_tree_view_row_expanded (treeview, path))
        gtk_tree_view_collapse_row (treeview, path);
      else
        gtk_tree_view_expand_row (treeview, path, FALSE);
      return;
    }
  else
    {
      toplevel = gtk_widget_get_toplevel (GTK_WIDGET (tree));
      if (GTK_IS_WINDOW (toplevel))
	gtk_window_activate_default (GTK_WINDOW (toplevel));
    }
}
Esempio n. 2
0
JNIEXPORT jboolean JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1activate_1default
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	gboolean result;
	jboolean _result;
	GtkWindow* self;

	// convert parameter self
	self = (GtkWindow*) _self;

	// call function
	result = gtk_window_activate_default(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jboolean) result;

	// and finally
	return _result;
}
Esempio n. 3
0
// GtkTreeViews eats return keys. I want this to be like a Windows listbox
// where pressing Return can still activate the default button.
gint AllowDefault(GtkWidget *widget, GdkEventKey *event, gpointer func_data)
{
	if (event->type == GDK_KEY_PRESS && event->keyval == GDK_Return)
	{
		gtk_window_activate_default (GTK_WINDOW(func_data));
	}
	return FALSE;
}
Esempio n. 4
0
int
clip_GTK_WINDOWACTIVATEDEFAULT(ClipMachine * cm)
{
	C_widget *cwin = _fetch_cw_arg(cm);
	CHECKCWID(cwin,GTK_IS_WINDOW);
	_clip_retni(cm,gtk_window_activate_default(GTK_WINDOW(cwin->widget)));
	return 0;
err:
	return 1;
}
static void
password_entry_activate (GtkWidget *widget, MatePasswordDialog *password_dialog)
{
	MatePasswordDialogDetails *priv = password_dialog->details;

	if (!priv->show_new_password) {
		gtk_window_activate_default (GTK_WINDOW (password_dialog));
		return;
	}

	if (priv->show_new_password) {
		gtk_widget_grab_focus (priv->new_password_entry);
	}
}
Esempio n. 6
0
static gboolean
gtk_listbox_key_press_callback( GtkWidget *WXUNUSED(widget),
                                GdkEventKey *gdk_event,
                                wxListBox *listbox )
{
    if ((gdk_event->keyval == GDK_Return) ||
        (gdk_event->keyval == GDK_ISO_Enter) ||
        (gdk_event->keyval == GDK_KP_Enter))
    {
        int index = -1;
        if (!listbox->HasMultipleSelection())
            index = listbox->GetSelection();
        else
        {
            wxArrayInt sels;
            if (listbox->GetSelections( sels ) < 1)
                return FALSE;
            index = sels[0];
        }

        if (index != wxNOT_FOUND)
        {
            listbox->GTKOnActivated(index);

//          wxMac and wxMSW always invoke default action
//          if (!ret)
            {
                // DClick not handled -> invoke default action
                wxWindow *tlw = wxGetTopLevelParent( listbox );
                if (tlw)
                {
                    GtkWindow *gtk_window = GTK_WINDOW( tlw->GetHandle() );
                    if (gtk_window)
                        gtk_window_activate_default( gtk_window );
                }
            }

            // Always intercept, otherwise we'd get another dclick
            // event from row_activated
            return TRUE;
        }
    }

    return FALSE;
}
Esempio n. 7
0
static void
pw_dialog_cycle_focus (GtkWidget         *widget,
                       GtkMountOperation *operation)
{
    GtkMountOperationPrivate *priv;
    GtkWidget *next_widget = NULL;

    priv = operation->priv;

    if (widget == priv->username_entry)
    {
        if (priv->domain_entry != NULL)
            next_widget = priv->domain_entry;
        else if (priv->password_entry != NULL)
            next_widget = priv->password_entry;
    }
    else if (widget == priv->domain_entry && priv->password_entry)
        next_widget = priv->password_entry;

    if (next_widget)
        gtk_widget_grab_focus (next_widget);
    else if (pw_dialog_input_is_valid (operation))
        gtk_window_activate_default (GTK_WINDOW (priv->dialog));
}
Esempio n. 8
0
static void
zenity_entry_combo_activate_default (GtkEntry *entry, gpointer window)
{
  gtk_window_activate_default (GTK_WINDOW (window));
}
Esempio n. 9
0
static gboolean
gtk_listbox_key_press_callback( GtkWidget *WXUNUSED(widget),
                                GdkEventKey *gdk_event,
                                wxListBox *listbox )
{
    if ((gdk_event->keyval == GDK_Return) ||
        (gdk_event->keyval == GDK_ISO_Enter) ||
        (gdk_event->keyval == GDK_KP_Enter))
    {
        int index = -1;
        if (!listbox->HasMultipleSelection())
            index = listbox->GetSelection();
        else
        {
            wxArrayInt sels;
            if (listbox->GetSelections( sels ) < 1)
                return FALSE;
            index = sels[0];
        }

        if (index != wxNOT_FOUND)
        {
            wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
            event.SetEventObject( listbox );

            GtkTreeEntry* entry = listbox->GTKGetEntry( index );

            // indicate that this is a selection
            event.SetExtraLong( 1 );

            event.SetInt( index );
            event.SetString(wxConvUTF8.cMB2WX(gtk_tree_entry_get_label(entry)));

            if ( listbox->HasClientObjectData() )
                event.SetClientObject(
                    (wxClientData*) gtk_tree_entry_get_userdata(entry)
                                 );
            else if ( listbox->HasClientUntypedData() )
                event.SetClientData( gtk_tree_entry_get_userdata(entry) );

            /* bool ret = */ listbox->HandleWindowEvent( event );

            g_object_unref (entry);

//          wxMac and wxMSW always invoke default action
//          if (!ret)
            {
                // DClick not handled -> invoke default action
                wxWindow *tlw = wxGetTopLevelParent( listbox );
                if (tlw)
                {
                    GtkWindow *gtk_window = GTK_WINDOW( tlw->GetHandle() );
                    if (gtk_window)
                        gtk_window_activate_default( gtk_window );
                }
            }

            // Always intercept, otherwise we'd get another dclick
            // event from row_activated
            return TRUE;
        }
    }

    return FALSE;
}