void
egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar,
				   GtkWidget          *widget)
{
  GtkWidget *toolbar, *toolitem;
  gboolean editable;

  etoolbar->priv->selected = widget;

  toolbar = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOLBAR) : NULL;
  toolitem = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) : NULL;

  if(toolbar != NULL)
    {
      gint tpos = get_toolbar_position (etoolbar, toolbar);
      editable = ((egg_toolbars_model_get_flags (etoolbar->priv->model, tpos) & EGG_TB_MODEL_NOT_EDITABLE) == 0);
    }
  else
    {
      editable = FALSE;
    }

  gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"), (toolbar != NULL) && (etoolbar->priv->edit_mode > 0));
  gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"), (toolitem != NULL) && editable);
  gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"), (toolitem != NULL) && editable);
}
Esempio n. 2
0
static void
_gtk_text_handle_parent_hierarchy_changed (GtkWidget     *widget,
                                           GtkWindow     *previous_toplevel,
                                           GtkTextHandle *handle)
{
  GtkWidget *toplevel, *scrollable;
  GtkTextHandlePrivate *priv;

  priv = handle->priv;
  toplevel = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);

  if (previous_toplevel && !toplevel)
    {
      if (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget)
        {
          _gtk_window_remove_popover (GTK_WINDOW (previous_toplevel),
                                      priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget);
          g_object_unref (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget);
          priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_START].widget = NULL;
        }

      if (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget)
        {
          _gtk_window_remove_popover (GTK_WINDOW (previous_toplevel),
                                      priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget);
          g_object_unref (priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget);
          priv->windows[GTK_TEXT_HANDLE_POSITION_SELECTION_END].widget = NULL;
        }
    }

  scrollable = gtk_widget_get_ancestor (widget, GTK_TYPE_SCROLLABLE);
  _gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable));
}
Esempio n. 3
0
/* Helper method to clear the text in a GtkEntry or GtkTextView and hide it */
static void
contacts_remove_entries (GtkWidget *entry)
{
	if (GTK_IS_ENTRY (entry)) {
		if (gtk_widget_get_ancestor (entry, GTK_TYPE_COMBO_BOX_ENTRY))
			return;

		gtk_entry_set_text (GTK_ENTRY (entry), "");
		gtk_widget_hide (entry);
	} else if (GTK_IS_TEXT_VIEW (entry)) {
		GtkTextBuffer *buffer =
			gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry));
			
		gtk_text_buffer_set_text (buffer, "", -1);
		
		entry = gtk_widget_get_ancestor (entry, GTK_TYPE_BIN);
		gtk_widget_hide (entry);
	} else if (GTK_IS_CONTAINER (entry)) {
		GList *c, *children =
			gtk_container_get_children (GTK_CONTAINER (entry));
		
		for (c = children; c; c = c->next)
			contacts_remove_entries (GTK_WIDGET (c->data));
		
		gtk_widget_hide (entry);
		
		g_list_free (children);
	}
}
Esempio n. 4
0
static gboolean
widget_is_in_temporary_bars (GtkWidget *widget,
			     NemoWindowPane *pane)
{
	gboolean res = FALSE;

	if ((gtk_widget_get_ancestor (widget, NEMO_TYPE_LOCATION_BAR) != NULL &&
	     pane->temporary_navigation_bar) ||
	    (gtk_widget_get_ancestor (widget, NEMO_TYPE_SEARCH_BAR) != NULL &&
	     pane->temporary_search_bar))
		res = TRUE;

	return res;
}
Esempio n. 5
0
void
contacts_remove_field_cb (GtkWidget *button, gpointer data)
{
	GtkWidget *window = gtk_widget_get_toplevel (button);
	GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
	GtkWidget *ancestor = gtk_widget_get_ancestor (
		widget, GTK_TYPE_EXPANDER);
	
	gtk_window_set_focus (GTK_WINDOW (window), NULL);

	if (ancestor) {
		contacts_remove_entries (ancestor);
		return;
	}

	ancestor = gtk_widget_get_ancestor (widget, GTK_TYPE_COMBO_BOX_ENTRY);
	if (ancestor) {
		const gchar *name;
		guint top, left;
		GtkWidget *table;
		GList *c, *children;
		
		ancestor = gtk_widget_get_ancestor (
			ancestor, GTK_TYPE_EVENT_BOX);
		name = gtk_widget_get_name (ancestor);
		table = gtk_widget_get_ancestor (ancestor, GTK_TYPE_TABLE);
		gtk_container_child_get (GTK_CONTAINER (table),
			ancestor, "left-attach", &left,
			"top-attach", &top, NULL);
			
		children = gtk_container_get_children (GTK_CONTAINER (table));
		for (c = children; c; c = c->next) {
			guint ctop, cleft;
			gtk_container_child_get (GTK_CONTAINER (table),
				GTK_WIDGET (c->data),
				"left-attach", &cleft,
				"top-attach", &ctop, NULL);
			if ((cleft == left+1) && (ctop == top)) {
				contacts_remove_entries (GTK_WIDGET (c->data));
				break;
			}
		}
		g_list_free (c);
		return;
	}
	
	contacts_remove_entries (widget);
}
/**
 * terminal_screen_container_get_from_screen:
 * @screen: a #TerminalScreenContainerPrivate
 *
 * Returns the #TerminalScreenContainer containing @screen.
 */
TerminalScreenContainer *
terminal_screen_container_get_from_screen (TerminalScreen *screen)
{
	g_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);

	return TERMINAL_SCREEN_CONTAINER (gtk_widget_get_ancestor (GTK_WIDGET (screen), TERMINAL_TYPE_SCREEN_CONTAINER));
}
/* We need to connect/disconnect signal handlers to toplevel window
   in which we reside. Ww want to update connected signals if our
   parent changes */
static void 
hildon_caption_hierarchy_changed                (GtkWidget *widget,
                                                 GtkWidget *previous_toplevel)
{
    GtkWidget *current_ancestor;

    if (GTK_WIDGET_CLASS (parent_class)->hierarchy_changed)
        GTK_WIDGET_CLASS (parent_class)->hierarchy_changed (widget, previous_toplevel);

    /* If we already were inside a window, remove old handler */
    if (previous_toplevel) {
        /* This is a compilation workaround for gcc > 3.3 since glib is buggy */
        /* see http://bugzilla.gnome.org/show_bug.cgi?id=310175 */
#ifdef __GNUC__
        __extension__
#endif
            g_signal_handlers_disconnect_by_func
            (previous_toplevel, (gpointer) hildon_caption_set_focus, widget);
    }

    current_ancestor = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);

    /* Install new handler for focus movement */
    if (current_ancestor)
        g_signal_connect( current_ancestor, "set-focus", 
                G_CALLBACK (hildon_caption_set_focus), widget );
}
static void
update_container_parent_informations (GstyleColorWidget *self)
{
  GtkWidget *parent;
  GtkWidget *grand_parent;
  GtkWidget *container;
  GstylePaletteWidget *palette_widget;

  g_assert (GSTYLE_IS_COLOR_WIDGET (self));

  parent = gtk_widget_get_parent (GTK_WIDGET (self));
  if (GTK_IS_LIST_BOX_ROW (parent) || GTK_IS_FLOW_BOX_CHILD (parent))
    {
      grand_parent = gtk_widget_get_parent (GTK_WIDGET (parent));
      if (grand_parent != NULL && g_str_has_prefix (gtk_widget_get_name (grand_parent), "palette"))
        {
          self->is_in_palette_widget = TRUE;
          container = gtk_widget_get_ancestor (grand_parent, GSTYLE_TYPE_PALETTE_WIDGET);
          if (container != NULL && GSTYLE_IS_PALETTE_WIDGET (container))
            {
              palette_widget = GSTYLE_PALETTE_WIDGET (container);
              self->container_view_mode = gstyle_palette_widget_get_view_mode (GSTYLE_PALETTE_WIDGET (palette_widget));

              return;
            }
        }
    }

  self->is_in_palette_widget = FALSE;
}
static void
mate_dock_build_children (GladeXML *xml, GtkWidget *w, GladeWidgetInfo *info)
{
	int i;
	GtkWidget *child;
	GtkWidget *toplevel;
	GladeChildInfo *childinfo;

	toplevel = gtk_widget_get_ancestor (w, MATE_TYPE_APP);

	for (i = 0; i < info->n_children; i++) {
		childinfo = &info->children[i];

		if (!strcmp (childinfo->child->classname, "MateComponentDockItem")) {
			mate_add_dock_item (xml, w, info, childinfo);
			continue;
		}
		
		if (matecomponent_dock_get_client_area (MATECOMPONENT_DOCK (w)))
			g_warning ("Multiple client areas for MateComponentDock found.");
		
		child = glade_xml_build_widget (xml, childinfo->child);
		
		if (toplevel != NULL)
		    mate_app_set_contents (MATE_APP (toplevel), child);
		else
		    matecomponent_dock_set_client_area (MATECOMPONENT_DOCK (w), child);
	}
}
G_MODULE_EXPORT void 
gw_addvocabularywindow_add_cb (GtkWidget *widget, gpointer data)
{
    GwAddVocabularyWindow *window;
    GwAddVocabularyWindowPrivate *priv;
    GwAddVocabularyWindowClass *klass;
    GtkListStore *wordstore;
    const gchar *kanji, *furigana, *definitions;

    window = GW_ADDVOCABULARYWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (data), GW_TYPE_ADDVOCABULARYWINDOW));
    g_return_if_fail (window != NULL);
    priv = window->priv;
    klass = GW_ADDVOCABULARYWINDOW_CLASS (G_OBJECT_GET_CLASS (window));

    kanji = gw_addvocabularywindow_get_kanji (window);
    furigana = gw_addvocabularywindow_get_furigana (window);
    definitions = gw_addvocabularywindow_get_definitions (window);
    wordstore = gw_addvocabularywindow_get_wordstore (window);
    priv->wordstore = GW_VOCABULARYWORDSTORE (wordstore);

    gw_vocabularywordstore_load (priv->wordstore, NULL);
    gw_vocabularywordstore_new_word (priv->wordstore, &(priv->iter), NULL, kanji, furigana, definitions);

    if (klass->last_selected_list_name != NULL)
      g_free (klass->last_selected_list_name);
    klass->last_selected_list_name = g_strdup (gw_addvocabularywindow_get_list (window));

    priv->valid = TRUE;

    g_signal_emit (G_OBJECT (window), klass->signalid[GW_ADDVOCABULARYWINDOW_CLASS_SIGNALID_WORD_ADDED], 0);

    gtk_widget_destroy (GTK_WIDGET (window));
}
void
ags_menu_bar_about_callback(GtkWidget *menu_item, AgsMenuBar *menu_bar)
{
  static FILE *file = NULL;
  struct stat sb;
  static gchar *license;
  static GdkPixbuf *logo;
  GError *error;

  gchar *authors[] = { "Joël Krähemann\0", NULL }; 

  if(file == NULL){
    file = fopen("./COPYING\0", "r\0");
    stat("./COPYING\0", &sb);
    license = (gchar *) malloc((sb.st_size + 1) * sizeof(gchar));
    fread(license, sizeof(char), sb.st_size, file);
    license[sb.st_size] = '\0';
    fclose(file);

    error = NULL;

    logo = gdk_pixbuf_new_from_file("./doc/images/ags.png\0", &error);
  }

  gtk_show_about_dialog((GtkWindow *) gtk_widget_get_ancestor((GtkWidget *) menu_bar, GTK_TYPE_WINDOW),
			"program-name\0", "ags\0",
			"authors\0", authors,
			"license\0", license,
			"version\0", AGS_VERSION,
			"website\0", "http://ags.sf.net\0",
			"title\0", "Advanced Gtk+ Sequencer\0",
			"logo\0", logo,
			NULL);
}
Esempio n. 12
0
static void
toggle_aspect_ratio (GSimpleAction *action,
                     GVariant      *parameter,
                     gpointer       data)
{
  GtkWidget *window;
  GdkGeometry geom;
  GtkWidget *widget = GTK_WIDGET (data);

  if (aspect_on)
    {
      geom.min_aspect = 0;
      geom.max_aspect = 65535;
    }
  else
    {
      geom.min_aspect = 1.777778;
      geom.max_aspect = 1.777778;
    }

  aspect_on = !aspect_on;

  window = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);
  if (window)
    gtk_window_set_geometry_hints (GTK_WINDOW (window),
				   GTK_WIDGET (data),
				   &geom,
				   GDK_HINT_ASPECT);

}
Esempio n. 13
0
G_MODULE_EXPORT gboolean
gw_settingswindow_dictionary_drag_drop_cb (
  GtkWidget *widget,
  GdkDragContext *context,
  gint x,
  gint y,
  guint time,
  gpointer user_data)
{
    GwSettingsWindow *window;
    GwSettingsWindowPrivate *priv;
    GtkTreeView *source;
    gboolean success;

    window = GW_SETTINGSWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (widget), GW_TYPE_SETTINGSWINDOW));
    g_return_val_if_fail (window != NULL, FALSE);
    priv = window->priv;
    source = GTK_TREE_VIEW (gtk_drag_get_source_widget (context));
    success = FALSE;

    if (source == priv->manage_dictionaries_treeview)
      gw_settingswindow_dictionary_drag_reorder (widget, context, x, y, time, user_data);

    gtk_drag_finish (context, success, FALSE, time);

    return success;
}
static void
bond_private_init (CEPageBond *self)
{
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);
	GtkBuilder *builder;

	builder = CE_PAGE (self)->builder;

	priv->mode = GTK_COMBO_BOX (gtk_builder_get_object (builder, "bond_mode"));
	priv->monitoring = GTK_COMBO_BOX (gtk_builder_get_object (builder, "bond_monitoring"));
	priv->frequency = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_frequency"));
	priv->updelay = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_updelay"));
	priv->updelay_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_updelay_label"));
	priv->updelay_box = GTK_WIDGET (gtk_builder_get_object (builder, "bond_updelay_box"));
	priv->downdelay = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_downdelay"));
	priv->downdelay_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_downdelay_label"));
	priv->downdelay_box = GTK_WIDGET (gtk_builder_get_object (builder, "bond_downdelay_box"));
	priv->arp_targets = GTK_ENTRY (gtk_builder_get_object (builder, "bond_arp_targets"));
	priv->arp_targets_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_arp_targets_label"));

	priv->toplevel = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (priv->mode),
	                                                      GTK_TYPE_WINDOW));

	priv->table = GTK_TABLE (gtk_builder_get_object (builder, "BondPage"));
	priv->table_row_spacing = gtk_table_get_default_row_spacing (priv->table);
	gtk_container_child_get (GTK_CONTAINER (priv->table), priv->updelay_label,
	                         "top-attach", &priv->updelay_row,
	                         NULL);
	gtk_container_child_get (GTK_CONTAINER (priv->table), priv->downdelay_label,
	                         "top-attach", &priv->downdelay_row,
	                         NULL);
	gtk_container_child_get (GTK_CONTAINER (priv->table), priv->arp_targets_label,
	                         "top-attach", &priv->arp_targets_row,
	                         NULL);
}
Esempio n. 15
0
void
gw_spellcheck_record_mouse_cordinates (GwSpellcheck *spellcheck, 
                                       GdkEvent     *event)
{
    GwSpellcheckPrivate *priv;
    GtkWidget *toplevel;
    gint toplevel_x, toplevel_y;

    priv = spellcheck->priv;
    toplevel = GTK_WIDGET (gtk_widget_get_ancestor (GTK_WIDGET (priv->entry), GTK_TYPE_WINDOW));

    gdk_window_get_device_position (
      gtk_widget_get_window (GTK_WIDGET (priv->entry)),
      gdk_event_get_device (event),
      &toplevel_x, 
      &toplevel_y, 
      NULL
    );

    gtk_widget_translate_coordinates (
      toplevel, 
      GTK_WIDGET (priv->entry), 
      toplevel_x, 
      toplevel_y, 
      &priv->x, 
      &priv->y
    );
}
void
ags_midi_preferences_add_callback(GtkWidget *widget, AgsMidiPreferences *midi_preferences)
{
  AgsWindow *window;
  AgsPreferences *preferences;
  AgsSequencerEditor *sequencer_editor;

  AgsSequencerThread *sequencer_thread;

  AgsThread *main_loop;
  
  AgsApplicationContext *application_context;

  GObject *sequencer;

  GList *start_list, *list;

  preferences = (AgsPreferences *) gtk_widget_get_ancestor(GTK_WIDGET(midi_preferences),
							   AGS_TYPE_PREFERENCES);
  window = (AgsWindow *) preferences->window;

  application_context = (AgsApplicationContext *) window->application_context;

  main_loop = ags_concurrency_provider_get_main_loop(AGS_CONCURRENCY_PROVIDER(application_context));
  
  /* retrieve first sequencer */
  sequencer = NULL;

  list =
    start_list = ags_sound_provider_get_sequencer(AGS_SOUND_PROVIDER(application_context));
  
  if(list != NULL){
    sequencer = list->data;
  }

  g_list_free_full(start_list,
		   g_object_unref);
  
  /* sequencer editor */
  sequencer_editor = ags_sequencer_editor_new();

  if(sequencer != NULL){
    sequencer_editor->sequencer = sequencer;
    sequencer_editor->sequencer_thread = (GObject *) ags_thread_find_type(main_loop,
									  AGS_TYPE_SEQUENCER_THREAD);
  }
  
  gtk_box_pack_start((GtkBox *) midi_preferences->sequencer_editor,
		     (GtkWidget *) sequencer_editor,
		     FALSE, FALSE,
		     0);
  
  ags_applicable_reset(AGS_APPLICABLE(sequencer_editor));
  ags_connectable_connect(AGS_CONNECTABLE(sequencer_editor));
  g_signal_connect(sequencer_editor->remove, "clicked",
		   G_CALLBACK(ags_midi_preferences_remove_sequencer_editor_callback), midi_preferences);
  gtk_widget_show_all((GtkWidget *) sequencer_editor);

  g_object_unref(main_loop);
}
static void
sync_tab_label (TerminalScreen *screen,
                GParamSpec *pspec,
                GtkWidget *label)
{
  GtkWidget *hbox;
  const char *title;
  TerminalWindow *window;

  title = terminal_screen_get_title (screen);
  hbox = gtk_widget_get_parent (label);

  gtk_label_set_text (GTK_LABEL (label),
                      title && title[0] ? title : _("Terminal"));

  gtk_widget_set_tooltip_text (hbox, title);

  /* This call updates the window size: bug 732588.
   * FIXMEchpe: This is probably a GTK+ bug, should get them fix it.
   */
  window = TERMINAL_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (label),
                                                     TERMINAL_TYPE_WINDOW));
  if (window != NULL)
    terminal_window_update_size (window);
}
Esempio n. 18
0
static gboolean
ide_editor_perspective_focus_if_found (IdeEditorPerspective *self,
                                       IdeBuffer            *buffer,
                                       gboolean              any_stack)
{
  IdeLayoutStack *stack;
  struct {
    IdeBuffer     *buffer;
    IdeLayoutView *view;
  } lookup = { buffer };

  g_return_val_if_fail (IDE_IS_EDITOR_PERSPECTIVE (self), FALSE);
  g_return_val_if_fail (IDE_IS_BUFFER (buffer), FALSE);

  stack = ide_layout_grid_get_current_stack (self->grid);

  if (any_stack)
    ide_layout_grid_foreach_view (self->grid, locate_view_for_buffer, &lookup);
  else
    ide_layout_stack_foreach_view (stack, locate_view_for_buffer, &lookup);

  if (lookup.view != NULL)
    {
      stack = IDE_LAYOUT_STACK (gtk_widget_get_ancestor (GTK_WIDGET (lookup.view),
                                                         IDE_TYPE_LAYOUT_STACK));
      ide_layout_stack_set_visible_child (stack, lookup.view);
      gtk_widget_grab_focus (GTK_WIDGET (lookup.view));
      return TRUE;
    }

  return FALSE;
}
static void
btn_dass_clicked (GtkButton *button, gpointer data)
{
    ExchangeAccount *account;
    account = exchange_operations_get_exchange_account ();
    exchange_delegates (account, gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW));
}
static gboolean
table_click_cb (GtkWidget *widget,
                GdkEventButton *event,
                gpointer data)
{
	ExchangeDelegates *delegates = data;
	GtkWidget *parent_window;
	GtkTreeIter iter;
	gint row;

	if (event->type != GDK_2BUTTON_PRESS)
		return FALSE;

	row = get_selected_row (delegates->table, &iter);
	if (row < 0 || row >= delegates->users->len)
		return FALSE;

	if (!get_folder_security (delegates))
		return FALSE;

	parent_window = gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW);
	exchange_delegates_user_edit (delegates->account, delegates->users->pdata[row],
				      parent_window);
	return TRUE;
}
G_MODULE_EXPORT void
gw_addvocabularywindow_definitions_paste_done_cb (GtkTextBuffer *buffer,
                                                  GtkClipboard  *clipboard,
                                                  gpointer       data      )
{
    GwAddVocabularyWindow *window;
    GwAddVocabularyWindowPrivate *priv;
    GtkTextIter start, end;
    gchar *text;

    window = GW_ADDVOCABULARYWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (data), GW_TYPE_ADDVOCABULARYWINDOW));
    g_return_if_fail (window != NULL);
    priv = window->priv;

    gtk_text_buffer_get_start_iter (buffer, &start);
    gtk_text_buffer_get_end_iter (buffer, &end);


    text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
    g_strdelimit (text, "\n", ' ');
    g_strstrip (text);

    gtk_text_buffer_set_text (buffer, text, -1);

    priv->pasted = TRUE;

    g_free (text);
}
Esempio n. 22
0
//!
//! @brief To be written
//!
G_MODULE_EXPORT int gw_kanjipadwindow_drawingarea_button_release_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
    GwKanjipadWindow *window;
    GwKanjipadWindowPrivate *priv;
    cairo_t *cr;

    //Initializations
    window = GW_KANJIPADWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (data), GW_TYPE_KANJIPADWINDOW));
    if (window == NULL) return FALSE;
    priv = window->priv;

    if (priv->annotate)
    {
      //Initializations
      cr = cairo_create(priv->surface);

      gw_kanjipadwindow_annotate_drawingarea_stroke (window, priv->curstroke, cr, g_list_length (priv->strokes) + 1);
      cairo_destroy(cr);
      gtk_widget_queue_draw (GTK_WIDGET (priv->drawingarea));
    }

    priv->strokes = g_list_append (priv->strokes, priv->curstroke);
    priv->curstroke = NULL;
    priv->instroke = FALSE;

    _kanjipadwindow_initialize_drawingarea (window);

    return FALSE;
}
Esempio n. 23
0
void on_load_ok_button_clicked(GtkButton *button, gpointer user_data)
{
	GtkWidget *load_select;
	FILE *infile;
	char *filename;
	char text[512];

	load_select = gtk_widget_get_ancestor(GTK_WIDGET(button),GTK_TYPE_FILE_SELECTION);
	filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(load_select));
	gtk_widget_hide(load_select);

	infile = fopen(filename,"r");
	if(infile == NULL) {
		fprintf(stderr,"IOL: can't open %s\n",filename);
		gtk_widget_destroy(load_select);
		return;
	}

	gtk_widget_destroy(load_select);

	gtk_text_freeze(script_text);

	/* since GTK+ (lamely) has no gtk_text_empty() or whatever,
	   so we have to revert to kludges :( */
	gtk_text_set_point(script_text,0);
	gtk_text_forward_delete(script_text,gtk_text_get_length(script_text));

	while(fgets(text,512,infile) != NULL)
		gtk_text_insert(script_text,script_font,NULL,NULL,text,strlen(text));

	fclose(infile);

	gtk_text_set_point(script_text,0);
	gtk_text_thaw(script_text);
}
static gboolean
gstyle_color_widget_key_pressed_cb (GstyleColorWidget *self,
                                    GdkEventKey       *event)
{
  GtkWidget *ancestor;
  GActionGroup *group;

  g_assert (GSTYLE_IS_COLOR_WIDGET (self));
  g_assert (event != NULL);

  if (event->type != GDK_KEY_PRESS)
    return GDK_EVENT_PROPAGATE;

  ancestor = gtk_widget_get_ancestor (GTK_WIDGET (self), GSTYLE_TYPE_PALETTE_WIDGET);
  if (event->keyval == GDK_KEY_F2 && ancestor != NULL)
    {
      group = gtk_widget_get_action_group (GTK_WIDGET (self), "gstyle-color-widget-menu");
      if (group != NULL)
        g_action_group_activate_action (group, "rename", NULL);

      return GDK_EVENT_STOP;
    }

  return GDK_EVENT_PROPAGATE;
}
Esempio n. 25
0
void
balsa_druid_page_directory_later(GtkWidget *druid)
{
    gchar *error = NULL;
    gchar *spool = libbalsa_guess_mail_spool();
    unconditional_mailbox(spool, INBOX_NAME, &balsa_app.inbox, &error);
    g_free(spool);
    SET_MAILBOX("trash",    TRASH_NAME,    &balsa_app.trash);
    SET_MAILBOX("outbox",   OUTBOX_NAME,   &balsa_app.outbox);
    SET_MAILBOX("sentbox",  SENTBOX_NAME,  &balsa_app.sentbox);
    SET_MAILBOX("draftbox", DRAFTBOX_NAME, &balsa_app.draftbox);
    if (error) {
        GtkWidget *dlg =
            gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_ancestor
                                          (GTK_WIDGET(druid), 
                                           GTK_TYPE_WINDOW)),
                                   GTK_DIALOG_MODAL,
                                   GTK_MESSAGE_ERROR,
                                   GTK_BUTTONS_OK,
                                   _("Problem Creating Mailboxes\n%s"),
                                   error);
        g_free(error);
        gtk_dialog_run(GTK_DIALOG(dlg));
        gtk_widget_destroy(dlg);
    }
}
Esempio n. 26
0
void on_load_cancel_button_clicked(GtkButton * button, gpointer user_data)
{
	GtkWidget *load_select;

	load_select = gtk_widget_get_ancestor(GTK_WIDGET(button),GTK_TYPE_FILE_SELECTION);
	gtk_widget_destroy(load_select);
}
Esempio n. 27
0
void
ags_drum_input_line_connect(AgsConnectable *connectable)
{
  AgsDrum *drum;
  AgsDrumInputLine *drum_input_line;
  GList *line_member;

  drum_input_line = AGS_DRUM_INPUT_LINE(connectable);


  if((AGS_LINE_CONNECTED & (AGS_LINE(drum_input_line)->flags)) != 0){
    return;
  }
  
  ags_drum_input_line_parent_connectable_interface->connect(connectable);

  /* AgsDrumInputLine */
  drum = AGS_DRUM(gtk_widget_get_ancestor((GtkWidget *) AGS_LINE(drum_input_line)->pad, AGS_TYPE_DRUM));

  /* AgsAudio */
  g_signal_connect_after(G_OBJECT(AGS_MACHINE(drum)->audio), "set_pads\0",
			 G_CALLBACK(ags_drum_input_line_audio_set_pads_callback), drum_input_line);

  /* AgsDrumInputLine */
}
Esempio n. 28
0
void on_save_ok_button_clicked(GtkButton * button, gpointer user_data)
{
	GtkWidget *save_select;
	FILE *outfile;
	gchar *file, *text;

	save_select = gtk_widget_get_ancestor(GTK_WIDGET(button),GTK_TYPE_FILE_SELECTION);
	file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(save_select));
	gtk_widget_hide(save_select);

	outfile = fopen(file,"w");
	if(outfile == NULL) {
		fprintf(stderr,"IOL: couldn't open %s\n",file);
		gtk_widget_destroy(save_select);
		return;
	}

	gtk_widget_destroy(save_select);

	gtk_text_freeze(script_text);

	text = gtk_editable_get_chars(GTK_EDITABLE(script_text),0,-1);
	fprintf(outfile,"%s",text);
	fclose(outfile);
	g_free(text);

	gtk_text_thaw(script_text);
}
static void
bond_private_init (CEPageBond *self)
{
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);
	GtkBuilder *builder;

	builder = CE_PAGE (self)->builder;

	priv->mode = GTK_COMBO_BOX (gtk_builder_get_object (builder, "bond_mode"));
	priv->primary = GTK_ENTRY (gtk_builder_get_object (builder, "bond_primary"));
	priv->primary_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_primary_label"));
	priv->monitoring = GTK_COMBO_BOX (gtk_builder_get_object (builder, "bond_monitoring"));
	priv->frequency = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_frequency"));
	priv->updelay = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_updelay"));
	priv->updelay_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_updelay_label"));
	priv->updelay_box = GTK_WIDGET (gtk_builder_get_object (builder, "bond_updelay_box"));
	priv->downdelay = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_downdelay"));
	priv->downdelay_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_downdelay_label"));
	priv->downdelay_box = GTK_WIDGET (gtk_builder_get_object (builder, "bond_downdelay_box"));
	priv->arp_targets = GTK_ENTRY (gtk_builder_get_object (builder, "bond_arp_targets"));
	priv->arp_targets_label = GTK_WIDGET (gtk_builder_get_object (builder, "bond_arp_targets_label"));
	priv->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "bond_mtu"));

	priv->toplevel = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (priv->mode),
	                                                      GTK_TYPE_WINDOW));
}
Esempio n. 30
0
void on_help_close_button_clicked(GtkButton *button, gpointer user_data)
{
	GtkWidget *help;

	help = gtk_widget_get_ancestor(GTK_WIDGET(button),GTK_TYPE_WINDOW);
	gtk_widget_destroy(help);
}