Пример #1
0
GtkWidget*
create_sheets_shapeselection_dialog (void)
{
  GtkWidget *sheets_shapeselection_dialog;
  GtkWidget *ok_button;
  GtkWidget *cancel_button1;

  sheets_shapeselection_dialog = gtk_file_selection_new (_("Select SVG Shape File"));
  gtk_object_set_data (GTK_OBJECT (sheets_shapeselection_dialog), "sheets_shapeselection_dialog", sheets_shapeselection_dialog);
  gtk_container_set_border_width (GTK_CONTAINER (sheets_shapeselection_dialog), 10);

  ok_button = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->ok_button;
  gtk_object_set_data (GTK_OBJECT (sheets_shapeselection_dialog), "ok_button", ok_button);
  gtk_widget_show (ok_button);
  GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);

  cancel_button1 = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->cancel_button;
  gtk_object_set_data (GTK_OBJECT (sheets_shapeselection_dialog), "cancel_button1", cancel_button1);
  gtk_widget_show (cancel_button1);
  GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);

  g_signal_connect (GTK_OBJECT (ok_button), "clicked",
                      G_CALLBACK (on_sheets_shapeselection_dialog_button_ok_clicked),
                      NULL);
  g_signal_connect (GTK_OBJECT (cancel_button1), "clicked",
                      G_CALLBACK (on_sheets_shapeselection_dialog_button_cancel_clicked),
                      NULL);

  return sheets_shapeselection_dialog;
}
Пример #2
0
void
gtk_combo_set_item_string (GtkCombo * combo, GtkItem * item, const gchar * item_value)
{
  gchar *val;
  gint connected = 0;

  g_return_if_fail (combo != NULL);
  g_return_if_fail (GTK_IS_COMBO (combo));
  g_return_if_fail (item != NULL);

  val = gtk_object_get_data (GTK_OBJECT (item), gtk_combo_string_key);
  if (val) 
    {
      g_free (val);
      connected = 1;
    }
  if (item_value)
    {
      val = g_strdup(item_value);
      gtk_object_set_data (GTK_OBJECT (item), gtk_combo_string_key, val);
      if (!connected)
        gtk_signal_connect (GTK_OBJECT (item), "destroy",
			  (GtkSignalFunc) gtk_combo_item_destroy, val);
    }
  else 
    {
      gtk_object_set_data (GTK_OBJECT (item), gtk_combo_string_key, NULL);
      if (connected)
	gtk_signal_disconnect_by_data(GTK_OBJECT (item), val);
    }
}
Пример #3
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_tool_item_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean visible_horz, visible_vert, is_important;

  visible_horz = gb_widget_input_bool (data, VisibleHorz);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), VisibleHorz,
			   visible_horz ? NULL : "FALSE");
    }

  visible_vert = gb_widget_input_bool (data, VisibleVert);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), VisibleVert,
			   visible_vert ? NULL : "FALSE");
    }

  is_important = gb_widget_input_bool (data, IsImportant);
  if (data->apply)
    {
      gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), is_important);
    }
}
Пример #4
0
void gtkTermSetMPref(GtkWidget *term, gtkTermPref *pref, int i)
{
	gpointer termPref;

	if((termPref = gtk_object_get_data(GTK_OBJECT(term), "mpref")) == NULL)
	{
		gtk_object_set_data(GTK_OBJECT(term), "mpref", GINT_TO_POINTER(-1));
		termPref = GINT_TO_POINTER(-1);
	}

	if(GPOINTER_TO_INT(termPref) != i)
	{
		if(i == -1)
		{
			vte_terminal_set_audible_bell(VTE_TERMINAL(term), pref->beep);
			vte_terminal_set_cursor_blinks(VTE_TERMINAL(term), pref->blink);
			vte_terminal_set_colors(VTE_TERMINAL(term), &pref->fore[0], &pref->back[0], pref->colors, 16);
			vte_terminal_set_scroll_on_output(VTE_TERMINAL(term), pref->scrollOnOutput);
			vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(term), pref->scrollOnKeyStroke);
			vte_terminal_set_word_chars (VTE_TERMINAL(term), pref->worldClass);
		}
		else
		{
			vte_terminal_set_audible_bell(VTE_TERMINAL(term), pref->mpref[i]->beep);
			vte_terminal_set_cursor_blinks(VTE_TERMINAL(term), pref->mpref[i]->blink);
			vte_terminal_set_colors(VTE_TERMINAL(term), &pref->mpref[i]->fore[0], &pref->mpref[i]->back[0], pref->mpref[i]->colors, 16);
			vte_terminal_set_scroll_on_output(VTE_TERMINAL(term), pref->mpref[i]->scrollOnOutput);
			vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(term), pref->mpref[i]->scrollOnKeyStroke);
			vte_terminal_set_word_chars (VTE_TERMINAL(term), pref->mpref[i]->worldClass);
		}
		gtk_object_set_data(GTK_OBJECT(term), "mpref", GINT_TO_POINTER(i));
	}
}
Пример #5
0
static void
sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
{
    SPItem *item;
    GtkWidget *w;

    item = (SPItem *) object;

    /* Link dialog */
    w = gtk_menu_item_new_with_mnemonic(_("Link _Properties"));
    gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_properties), item);
    gtk_widget_show(w);
    gtk_menu_append(GTK_MENU(m), w);
    /* Select item */
    w = gtk_menu_item_new_with_mnemonic(_("_Follow Link"));
    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_follow), item);
    gtk_widget_show(w);
    gtk_menu_append(GTK_MENU(m), w);
    /* Reset transformations */
    w = gtk_menu_item_new_with_mnemonic(_("_Remove Link"));
    gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_remove), item);
    gtk_widget_show(w);
    gtk_menu_append(GTK_MENU(m), w);
}
Пример #6
0
void
on_keyboard_import_button_clicked      (GtkButton       *button,
                                        gpointer         user_data)
{
	/* Wait for this until GTK+2.4 is standard:
	char *filename;
	
	filename = get_filename_from_user( "Open keyboard file", gtk_widget_get_toplevel(GTK_WIDGET(button)) );
	if (filename)
	{
		keyboard_import (filename, &keyboard_list);
		reload_keyboard_list (GTK_WIDGET(button), &keyboard_list);
		free (filename);
	}*/
	GtkWidget *fileselection_window;

	fileselection_window = create_fileselection_window(); /* Create the file selection window */
	/*
	 * Set data, containing the pointer to the function which process the filename,
	 * to fileselection_window
	 */
	gtk_object_set_data (GTK_OBJECT(fileselection_window), "process filename", linkto_keyboard_import);
	/* Set data, containing the pointer to the keyboard window, to the file selection window */
	gtk_object_set_data (GTK_OBJECT(fileselection_window), "process widget", gtk_widget_get_toplevel( GTK_WIDGET(button) ));
	/* NOT: Let the file selection window only show file which end with '.kti' */
	/* gtk_file_selection_complete (GTK_FILE_SELECTION(fileselection_window), "*.kti"); */
	gtk_widget_show (fileselection_window); /* Show the file selection window */
}
Пример #7
0
GtkWidget *
c2_dialog_new (C2Application *application, const gchar *title, const gchar *type, const gchar *icon, ...)
{
	C2Dialog *dialog;
	va_list args;

	dialog = gtk_type_new (c2_dialog_get_type ());
	va_start (args, icon);
	gnome_dialog_construct (GNOME_DIALOG (dialog), title, args);
	va_end (args);
	dialog->application = application;
	gtk_object_set_data (GTK_OBJECT (dialog), "type", g_strdup (type));

	if (icon)
	{
		gtk_object_set_data (GTK_OBJECT (dialog), "icon", g_strdup (icon));
#ifdef USE_GNOME_WINDOW_ICON
		gnome_window_icon_set_from_file (GTK_WINDOW (dialog), icon);
#endif
	}

	c2_application_window_add (application, GTK_WINDOW (dialog));

	return GTK_WIDGET (dialog);
}
Пример #8
0
static void
on_toggle_default_height (GtkWidget * widget, gpointer value)
{
  GtkWidget *property_widget;
  gboolean value_set;
  gint width, height;

  property_widget = property_get_widget ();
  if (property_widget == NULL)
    return;

  value_set = GTK_TOGGLE_BUTTON (widget)->active ? TRUE : FALSE;
  gtk_widget_set_sensitive (GTK_WIDGET (value), value_set);

  if (value_set)
    {
      height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (value));
      gtk_object_set_data (GTK_OBJECT (property_widget), DefaultHeight,
			   GINT_TO_POINTER (height));
    }
  else
    {
      height = -1;
      gtk_object_set_data (GTK_OBJECT (property_widget), DefaultHeight,
			   NULL);
    }

   width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (property_widget),
						 DefaultWidth));
   gtk_window_set_default_size (GTK_WINDOW (property_widget),
				width != 0 ? width : -1, height);
}
Пример #9
0
GtkWidget*
create_fileselection (void)
{
  GtkWidget *fileselection;
  GtkWidget *filesel_ok;
  GtkWidget *filesel_cancel;

  fileselection = gtk_file_selection_new ("Select File");
  gtk_object_set_data (GTK_OBJECT (fileselection), "fileselection", fileselection);
  gtk_container_set_border_width (GTK_CONTAINER (fileselection), 10);
  gtk_window_set_modal (GTK_WINDOW (fileselection), TRUE);

  filesel_ok = GTK_FILE_SELECTION (fileselection)->ok_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_ok", filesel_ok);
  gtk_widget_show (filesel_ok);
  GTK_WIDGET_SET_FLAGS (filesel_ok, GTK_CAN_DEFAULT);

  filesel_cancel = GTK_FILE_SELECTION (fileselection)->cancel_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_cancel", filesel_cancel);
  gtk_widget_show (filesel_cancel);
  GTK_WIDGET_SET_FLAGS (filesel_cancel, GTK_CAN_DEFAULT);

  gtk_signal_connect (GTK_OBJECT (fileselection), "destroy",
                      GTK_SIGNAL_FUNC (on_fileselection_destroy),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_ok), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_ok_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_cancel), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_cancel_clicked),
                      NULL);

  return fileselection;
}
Пример #10
0
static void
menu_choice_activate (GtkWidget *item,
		      gpointer   data)
{
  gpointer udata = gtk_object_get_user_data (GTK_OBJECT (item));
  
  if (GTK_IS_MENU (current_popup_menu))
    {
      gtk_object_set_data (GTK_OBJECT (current_popup_menu), "BstChoice", udata);
      
      if (modal_loop_quit_on_menu_item_activate)
	modal_loop_running = FALSE;
    }
  else	/* current_popup_menu is not set e.g. for option menus */
    {
      while (GTK_IS_MENU (item->parent))
	{
	  GtkWidget *tmp;
          
	  item = item->parent;
	  tmp = gtk_menu_get_attach_widget (GTK_MENU (item));
	  if (GTK_IS_MENU_ITEM (tmp))
	    item = tmp;
	}
      g_assert (GTK_IS_MENU (item));
      
      gtk_object_set_data (GTK_OBJECT (item), "BstChoice", udata);
    }
}
Пример #11
0
static GtkWidget *
control_create (GbWidgetNewData * data, char *obj_id, Bonobo_UIContainer uic)
{
  GtkWidget               *widget;
  BonoboControlFrame      *cf;
  Bonobo_PropertyBag       pb;

  g_return_val_if_fail (obj_id != NULL, NULL);

  widget = bonobo_widget_new_control (obj_id, uic);
  
  g_return_val_if_fail (widget != NULL, NULL);
  cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));

  if (!cf) {
    g_warning ("Control has no frame!");
    gtk_widget_destroy (widget);

    return NULL;
  }

  pb = bonobo_control_frame_get_control_property_bag (cf, NULL);

  gtk_object_set_data (GTK_OBJECT (widget), GladePropertyBagKey, pb);
  gtk_object_set_data (GTK_OBJECT (widget), Moniker, g_strdup (obj_id));

  /* Make sure the GbWidget for this control is created & registered,
     and set the real GbWidget for this control. */
  data->widget_data->gbwidget = control_get_gb_widget (obj_id);

  return widget;
}
Пример #12
0
GtkWidget* webkit_view___::webview_new__(GtkWidget* scrolled) {
	GtkWidget* webview = webkit_web_view_new ();
	//g_object_ref_sink(webview);
	gtk_object_set_data(GTK_OBJECT(webview),object_data_view_,(gpointer)this);
	if(scrolled) {
		gtk_object_set_data(GTK_OBJECT(webview),object_data_scrolled_,(gpointer)scrolled);
		//gtk_container_add (GTK_CONTAINER (scrolled), webview);
		GtkWidget* scrolled2 = gtk_scrolled_window_new (NULL, NULL);
		gtk_container_add (GTK_CONTAINER (scrolled2), webview);
		gtk_container_add (GTK_CONTAINER (scrolled), scrolled2);
		outer_scrolled_ = scrolled2;

		if(is_app_paintable_) {
			webkit_web_view_set_transparent(WEBKIT_WEB_VIEW(webview), true);
		}

		g_signal_connect(webview,"window-object-cleared",G_CALLBACK(window_object_cleared__),NULL);
		g_object_connect(G_OBJECT(webview),
				"signal::geolocation-policy-decision-requested",
				geolocation_policy_decision_requested__, 0, NULL);
		signal_connect__(webview);
	}
	if(!user_agent_.empty()) {
		WebKitWebSettings* wws=webkit_web_view_get_settings(WEBKIT_WEB_VIEW(webview));
		WebKitWebSettings* wws2=webkit_web_settings_copy(wws);
		g_object_set((GObject*)wws2, "user-agent", user_agent_.c_str(), NULL);
		webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), wws2);
	}

	return webview;
}
Пример #13
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_combo_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gboolean value_in_list, ok_if_empty, case_sensitive, arrows, arrows_always;
  gchar *items;
  GList *item_list = NULL;

  value_in_list = gb_widget_input_bool (data, ValueInList);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), ValueInList,
			   value_in_list ? "TRUE" : NULL);
    }

  ok_if_empty = gb_widget_input_bool (data, OKIfEmpty);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), OKIfEmpty,
			   ok_if_empty ? "TRUE" : NULL);
    }

  case_sensitive = gb_widget_input_bool (data, Case);
  if (data->apply)
    gtk_combo_set_case_sensitive (GTK_COMBO (widget), case_sensitive);
  arrows = gb_widget_input_bool (data, Arrows);
  if (data->apply)
    gtk_combo_set_use_arrows (GTK_COMBO (widget), arrows);
  arrows_always = gb_widget_input_bool (data, Always);
  if (data->apply)
    gtk_combo_set_use_arrows_always (GTK_COMBO (widget), arrows_always);

  items = gb_widget_input_text (data, Items);
  if (data->apply)
    {
      gchar *pos = items;
      gchar *items_end = &items[strlen (items)];

      while (pos < items_end)
	{
	  gchar *item_end = strchr (pos, '\n');
	  if (item_end == NULL)
	    item_end = items_end;
	  *item_end = '\0';
	  item_list = g_list_append (item_list, pos);
	  pos = item_end + 1;
	}
      if (item_list)
	gtk_combo_set_popdown_strings (GTK_COMBO (widget), item_list);
      else
	gtk_list_clear_items (GTK_LIST (GTK_COMBO (widget)->list), 0, -1);
      g_list_free (item_list);
    }
  if (data->action == GB_APPLYING)
    g_free (items);
}
Пример #14
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_custom_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
    gchar *creation_function, *string1, *string2;
    gint int1, int2;

    creation_function = gb_widget_input_string (data, CreationFunction);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), CreationFunction));
        gtk_object_set_data (GTK_OBJECT (widget), CreationFunction,
                             g_strdup (creation_function));

        /* If we are applying the property, we set the last modification time. */
        if (data->action == GB_APPLYING)
        {
            gb_custom_set_last_mod_time (widget, -1);
        }
    }

    string1 = gb_widget_input_string (data, String1);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), String1));
        gtk_object_set_data (GTK_OBJECT (widget), String1, g_strdup (string1));
    }

    string2 = gb_widget_input_string (data, String2);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), String2));
        gtk_object_set_data (GTK_OBJECT (widget), String2, g_strdup (string2));
    }

    int1 = gb_widget_input_int (data, Int1);
    if (data->apply)
        gtk_object_set_data (GTK_OBJECT (widget), Int1, GINT_TO_POINTER (int1));

    int2 = gb_widget_input_int (data, Int2);
    if (data->apply)
        gtk_object_set_data (GTK_OBJECT (widget), Int2, GINT_TO_POINTER (int2));

    /* If we are loading, load the last modification time. */
    if (data->action == GB_LOADING)
    {
        time_t last_mod_time;

        last_mod_time = load_date (data, LastModTime);
        if (data->apply)
        {
            gb_custom_set_last_mod_time (widget, last_mod_time);
        }
    }
}
Пример #15
0
GtkWidget *newSample(const gchar *fileName)
{
  Context *context = NEW_ARRAY(Context, 1);
  gchar *title;
  GtkWidget *app;
  GtkWidget *area;
  GtkStyle *style;
  int i;

  context->width  = 600;
  context->height = 400;
  context->paragraph = pf_factory(fileName, font, guiSupport);

  title = prettyTitle(fileName);
  app = gnome_app_new("gnomeLayout", title);

  gtk_object_set_data(GTK_OBJECT(app), "context", context);

  gtk_window_set_default_size(GTK_WINDOW(app), 600 - 24, 400);

  gnome_app_create_menus_with_data(GNOME_APP(app), mainMenu, app);

  gtk_signal_connect(GTK_OBJECT(app), "delete_event",
             GTK_SIGNAL_FUNC(eventDelete), NULL);

  area = gtk_drawing_area_new();
  gtk_object_set_data(GTK_OBJECT(app), "area", area);

  style = gtk_style_copy(gtk_widget_get_style(area));

  for (i = 0; i < 5; i += 1) {
    style->fg[i] = style->white;
  }
    
  gtk_widget_set_style(area, style);

  gnome_app_set_contents(GNOME_APP(app), area);

  gtk_signal_connect(GTK_OBJECT(area),
             "expose_event",
             GTK_SIGNAL_FUNC(eventExpose),
             context);

  gtk_signal_connect(GTK_OBJECT(area),
             "configure_event",
             GTK_SIGNAL_FUNC(eventConfigure),
             context);

  appList = g_slist_prepend(appList, app);

  g_free(title);

  return app;
}
Пример #16
0
guint
bst_choice_modal (GtkWidget *choice,
		  guint      mouse_button,
		  guint32    time)
{
  gpointer data = GUINT_TO_POINTER (0);
  
  if (GTK_IS_MENU (choice))
    {
      GtkMenu *menu = GTK_MENU (choice);
      
      gtk_object_set_data (GTK_OBJECT (menu), "BstChoice", data);
      
      if (bst_choice_selectable (choice))
	{
	  modal_loop_quit_on_menu_item_activate = TRUE;
	  modal_loop_running = TRUE;
	  current_popup_menu = GTK_WIDGET (menu);
	  gtk_menu_popup (menu, NULL, NULL, NULL, NULL, mouse_button, time);
	  while (modal_loop_running)
	    {
	      GDK_THREADS_LEAVE ();
	      g_main_iteration (TRUE);
	      GDK_THREADS_ENTER ();
	    }
	  current_popup_menu = NULL;
	  modal_loop_quit_on_menu_item_activate = FALSE;
	}
      
      data = gtk_object_get_data (GTK_OBJECT (menu), "BstChoice");
    }
  else if (GXK_IS_DIALOG (choice))
    {
      gtk_object_set_data (GTK_OBJECT (choice), "BstChoice", data);
      
      if (bst_choice_selectable (choice))
	{
	  gtk_widget_show (choice);
          
          while (GTK_WIDGET_VISIBLE (choice))
	    {
	      GDK_THREADS_LEAVE ();
	      g_main_iteration (TRUE);
	      GDK_THREADS_ENTER ();
	    }
	}
      
      data = gtk_object_get_data (GTK_OBJECT (choice), "BstChoice");
    }
  
  return GPOINTER_TO_UINT (data);
}
Пример #17
0
void 
ghack_menu_window_start_menu (GtkWidget *menuWin, gpointer data)
{
    GtkWidget *frame1, *swin, *clist;
    MenuWinType isMenu;
    
    g_assert (menuWin != NULL);
    g_assert (data == NULL);

    /* destroy existing menu data, if any */
    frame1 = gtk_object_get_data (GTK_OBJECT (menuWin), "frame1");
    if (frame1)
      gtk_widget_destroy (frame1);
 
    isMenu = MenuMenu;
    gtk_object_set_data (GTK_OBJECT (menuWin), "isMenu",
    			 GINT_TO_POINTER (isMenu));

    gtk_widget_set_usize (GTK_WIDGET (menuWin), 500, 400);
    gtk_window_set_policy (GTK_WINDOW (menuWin), TRUE, TRUE, FALSE);

    frame1 = gtk_frame_new ("Make your selection");
    g_assert (frame1 != NULL);
    gtk_object_set_data (GTK_OBJECT(menuWin), "frame1", frame1);
    gtk_widget_show (GTK_WIDGET (frame1));
    gtk_container_set_border_width (GTK_CONTAINER (frame1), 5);
    gtk_box_pack_start (GTK_BOX (GNOME_DIALOG(menuWin)->vbox), frame1,
                        TRUE, TRUE, 0);
    
    swin = gtk_scrolled_window_new (NULL, NULL);
    g_assert (swin != NULL);
    gtk_object_set_data (GTK_OBJECT(menuWin), "swin", swin);
    gtk_widget_show (GTK_WIDGET (swin));
    gtk_container_add (GTK_CONTAINER (frame1), swin);

    clist = gtk_clist_new (4);
    g_assert (clist != NULL);
    gtk_object_set_data (GTK_OBJECT(menuWin), "clist", clist);
    gtk_widget_show (GTK_WIDGET (clist));
    gtk_container_add (GTK_CONTAINER (swin), clist);

    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
	    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

    gtk_signal_connect (GTK_OBJECT (clist), "select_row",
	    GTK_SIGNAL_FUNC (ghack_menu_row_selected), NULL);
    gtk_object_set_data (GTK_OBJECT (clist), "numItems",
			    GINT_TO_POINTER (-1));
}    
Пример #18
0
GtkWidget*
create_romfile_fileselection (void)
{
  GtkWidget *romfile_fileselection;
  GtkWidget *ok_button2;
  GtkWidget *cancel_button2;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  romfile_fileselection = gtk_file_selection_new (_("Select a ROM to load"));
  gtk_widget_set_name (romfile_fileselection, "romfile_fileselection");
  gtk_object_set_data (GTK_OBJECT (romfile_fileselection), "romfile_fileselection", romfile_fileselection);
  gtk_container_set_border_width (GTK_CONTAINER (romfile_fileselection), 10);
  gtk_window_set_modal (GTK_WINDOW (romfile_fileselection), TRUE);

  ok_button2 = GTK_FILE_SELECTION (romfile_fileselection)->ok_button;
  gtk_widget_set_name (ok_button2, "ok_button2");
  gtk_object_set_data (GTK_OBJECT (romfile_fileselection), "ok_button2", ok_button2);
  gtk_widget_show (ok_button2);
  GTK_WIDGET_SET_FLAGS (ok_button2, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (ok_button2, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  cancel_button2 = GTK_FILE_SELECTION (romfile_fileselection)->cancel_button;
  gtk_widget_set_name (cancel_button2, "cancel_button2");
  gtk_object_set_data (GTK_OBJECT (romfile_fileselection), "cancel_button2", cancel_button2);
  gtk_widget_show (cancel_button2);
  GTK_WIDGET_SET_FLAGS (cancel_button2, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (cancel_button2, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  gtk_signal_connect (GTK_OBJECT (romfile_fileselection), "destroy",
                      GTK_SIGNAL_FUNC (on_romfile_fileselection_destroy),
                      romfile_fileselection);
  gtk_signal_connect (GTK_OBJECT (ok_button2), "clicked",
                      GTK_SIGNAL_FUNC (on_romfile_ok_button2_clicked),
                      romfile_fileselection);
  gtk_signal_connect (GTK_OBJECT (cancel_button2), "clicked",
                      GTK_SIGNAL_FUNC (on_romfile_cancel_button2_clicked),
                      romfile_fileselection);

  gtk_window_add_accel_group (GTK_WINDOW (romfile_fileselection), accel_group);

  return romfile_fileselection;
}
Пример #19
0
static GtkWidget*
new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
{
	GtkWidget *window;
	GtkWidget *vbox;
	GtkWidget *temp_box;
	GtkWidget *button;
	GtkWidget *drawing_area;
	gint w, h;
 
	w = gdk_pixbuf_get_width (pixbuf);
	h = gdk_pixbuf_get_height (pixbuf);

	window = gtk_widget_new (gtk_window_get_type (),
				 "GtkObject::user_data", NULL,
				 "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
				 "GtkWindow::title", "testrgb",
				 "GtkWindow::allow_shrink", TRUE,
				 NULL);
	gtk_signal_connect (GTK_OBJECT (window), "destroy",
			    (GtkSignalFunc) quit_func, NULL);

	vbox = gtk_vbox_new (FALSE, 0);

	if (title)
		gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title),
				    TRUE, TRUE, 0);

	drawing_area = gtk_drawing_area_new ();

	temp_box = gtk_hbox_new (FALSE, 0);
	gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
	gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
	

	gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
			    GTK_SIGNAL_FUNC(expose_func), NULL);
	gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
			    GTK_SIGNAL_FUNC (config_func), NULL);

	gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);

	gtk_widget_show (drawing_area);

	button = gtk_button_new_with_label ("Quit");
	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
				   (GtkSignalFunc) gtk_widget_destroy,
				   GTK_OBJECT (window));

	gtk_widget_show (button);

	gtk_container_add (GTK_CONTAINER (window), vbox);
	gtk_widget_show_all (vbox);

	gtk_widget_show (window);

        return window;
}
Пример #20
0
void gtkAddHelpString(
		GtkWidget * widget,
		const char * helpStr )
{
	int rc;
	char *string;
	wBalloonHelp_t * bhp;
	rc = 0;
	if (helpStr==NULL || *helpStr==0)
		return;
	if ( balloonHelpStrings == NULL )
		return;
	for ( bhp = balloonHelpStrings; bhp->name && strcmp(bhp->name,helpStr) != 0; bhp++ );
	if (listMissingHelpStrings && !bhp->name) {
		printf( "Missing Help String: %s\n", helpStr );
		return;
	}
	string = malloc( strlen(wAppName) + 5 + strlen(helpStr) + 1 );
	sprintf( string, "%sHelp/%s", wAppName, helpStr );
	if (tooltips)
		gtk_tooltips_set_tip( tooltips, widget, _(bhp->value), string );
	gtk_object_set_data( GTK_OBJECT( widget ), HelpDataKey, string );
	if (listHelpStrings)
		printf( "HELPSTR - %s\n", string );
}
void
c2_transfer_list_add_item (C2TransferList *tl, C2TransferItem *ti)
{
	c2_return_if_fail (C2_IS_TRANSFER_ITEM (ti), C2EDATA);

	/* If it a retrieve TI and we already have a retrieve TI for this
	 * account, remove the old one.
	 */
	if (ti->type == C2_TRANSFER_ITEM_RECEIVE)
	{
		GSList *l;

		for (l = tl->list; l != NULL; )
		{
			GSList *next = g_slist_next(l);
			C2TransferItem *cti = (C2TransferItem*) l->data;

			if (cti->type == C2_TRANSFER_ITEM_RECEIVE &&
				cti->account == ti->account)
			{
				tl->list = g_slist_remove (tl->list, cti);
				gtk_object_destroy (GTK_OBJECT (cti));
			}
			l = next;
		}
	}

	tl->list = g_slist_append (tl->list, ti);

	gtk_box_pack_start (GTK_BOX (tl->vbox), ti->event, FALSE, TRUE, 0);

	gtk_object_set_data (GTK_OBJECT (ti), "transfer list", tl);
	gtk_signal_connect (GTK_OBJECT (ti), "finish",
						GTK_SIGNAL_FUNC (on_transfer_item_finish), tl);
}
Пример #22
0
/*
 * Creates a new GtkWidget of class GnomeApp, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
static GtkWidget*
gb_gnome_app_new (GbWidgetNewData *data)
{
  GtkWidget *new_widget;
  gchar *project_name;

  project_name = glade_project_get_name (data->project);
  new_widget = gnome_app_new (project_name ? project_name : "", project_name);
  gtk_object_set_data (GTK_OBJECT (new_widget), EnableLayoutConfig,
		       GINT_TO_POINTER (TRUE));

  /* Turn off the automatic loading/saving of the configuration, and
     destroy the BonoboDockLayout, so that when items are added they are
     added straight away. If we don't do this, items don't get added to
     the widget tree. */
  gnome_app_enable_layout_config (GNOME_APP (new_widget), FALSE);
  g_object_unref (G_OBJECT (GNOME_APP (new_widget)->layout));
  GNOME_APP (new_widget)->layout = NULL;

  gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
		      GTK_SIGNAL_FUNC (editor_close_window), NULL);

  gb_widget_create_from (GNOME_APP (new_widget)->dock,
			 data->action == GB_CREATING ? "BonoboDock" : NULL);
  gb_widget_set_child_name (GNOME_APP (new_widget)->dock, GladeChildGnomeAppDock);

  if (data->action == GB_CREATING)
    gb_gnome_app_setup_initial_app (new_widget);

  return new_widget;
}
Пример #23
0
static void
list_bookmarks (GtkWidget *menu, struct connect_context *cc)
{
	struct dirent *de;
	char *file;
	char path[MAXPATHLEN];
	GtkWidget *item;
	DIR *dir;

	expand_tilde(path, "~/.hx/bookmarks");
	dir = opendir(path);
	if (!dir)
		return;
	while ((de = readdir(dir))) {
		if (*de->d_name != '.') {
			file = xstrdup(de->d_name);
			item = gtk_menu_item_new_with_label(file);
			gtk_menu_append(GTK_MENU(menu), item);
			gtk_object_set_data(GTK_OBJECT(item), "cc", cc);
			gtk_signal_connect(GTK_OBJECT(item), "activate",
					   GTK_SIGNAL_FUNC(open_bookmark), file);
		}
	}
	closedir(dir);
}
Пример #24
0
PRIVATE void evt_record_handler(Generator *g, AEvent *event) {
  gboolean start = (event->d.number > 0.5);
  Data *data = g->data;

  if (start) {
    GtkWidget *fs = gtk_file_selection_new("Select Output WAV File");

    gtk_object_set_data(GTK_OBJECT(fs), "Generator", g);
    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked",
		       GTK_SIGNAL_FUNC(access_output_file), fs);
    gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(fs)->cancel_button), "clicked",
			      GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fs));

    if (data->filename != NULL)
      gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), data->filename);

    gtk_window_set_modal(GTK_WINDOW(fs), TRUE);
    gtk_widget_show(fs);
  } else {
    if (data->output != NULL) {
      afCloseFile(data->output);
      data->output = NULL;
    }

    popup_msgbox("Recording Complete", MSGBOX_OK, 0, MSGBOX_OK,
		 "Recorded %g seconds (%d frames) of data to file\n"
		 "%s",
		 (float) data->frames_recorded / (SAMPLE_RATE), data->frames_recorded,
		 data->filename ? data->filename : "<anonymous>");
  }
}
Пример #25
0
static void
show_tclist_dialog (GbWidgetNewData * data)
{
  GtkWidget *dialog, *vbox, *hbox, *label, *spinbutton;
  GtkObject *adjustment;

  dialog = glade_util_create_dialog (_("New tree columned list"), data->parent,
				     on_tclist_dialog_ok, data, &vbox);
  gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
		      GTK_SIGNAL_FUNC (on_tclist_dialog_destroy), data);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
  gtk_container_border_width (GTK_CONTAINER (hbox), 10);
  gtk_widget_show (hbox);

  label = gtk_label_new (_("Number of columns:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 5);
  gtk_widget_show (label);

  adjustment = gtk_adjustment_new (3, 1, 100, 1, 10, 10);
  spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
  /* save pointer to spinbutton so we can find it easily in the OK handler */
  gtk_object_set_data (GTK_OBJECT (dialog), "cols", spinbutton);
  gtk_box_pack_start (GTK_BOX (hbox), spinbutton, TRUE, TRUE, 5);
  gtk_widget_set_usize (spinbutton, 50, -1);
  gtk_widget_grab_focus (spinbutton);
  gtk_widget_show (spinbutton);

  gtk_widget_show (dialog);
  gtk_grab_add (dialog);
}
Пример #26
0
static void
gb_tclist_add_child (GtkWidget *widget, GtkWidget *child, GbWidgetSetArgData *data)
{
  gchar *child_name = load_get_value (data, "child_name");

  /* FIXME: This should use CListTitle from gbclist.c */
  if (child_name && (!strcmp (child_name, "CList:title")
                     || !strcmp (child_name, "CTree:title")))
    {
      /* We store the last column title read in 'last_child' */
      gint col = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
                                                       "last_child"));

      gtk_clist_set_column_widget (GTK_CLIST (widget), col, child);
      gtk_object_set_data (GTK_OBJECT (widget), "last_child",
                           GINT_TO_POINTER (col + 1));

      /* We need to add signals to the clist button, just in case the
         title widget has no window and so doesn't get signals itself.
         Since Clist always creates 1 button initially, the signals would
         be added to this button in gb_widget_new, so we could skip it,
         but it doesn't hurt. */
      editor_add_mouse_signals_to_existing (GTK_CLIST (widget)->column[col].button);
    }
  else
    {
      gtk_container_add (GTK_CONTAINER (widget), child);
    }
}
Пример #27
0
static void mimeview_launch(MimeView *mimeview)
{
	MimeInfo *partinfo;
	gchar *filename;

	if (!mimeview->opened) return;
	if (!mimeview->file) return;

	partinfo = mimeview_get_selected_part(mimeview);
	if (!partinfo) { 
		partinfo = (MimeInfo *) gtk_object_get_data
			(GTK_OBJECT(mimeview->popupmenu),
			 "pop_partinfo");
		gtk_object_set_data(GTK_OBJECT(mimeview->popupmenu),
				    "pop_partinfo", NULL);
	}			 
	g_return_if_fail(partinfo != NULL);

	filename = procmime_get_tmp_file_name(partinfo);

	if (procmime_get_part(filename, partinfo) < 0)
		alertpanel_error
			(_("Can't save the part of multipart message."));
	else
		mimeview_view_file(filename, partinfo, NULL);

	g_free(filename);
}
Пример #28
0
static void
add_to_menu(GtkWidget* menu, GnomeRecentDocument *doc)
{
        GtkWidget *mi;
        const gchar* name;
        GtkWidget *label;
        
        name = gnome_recent_document_peek(doc, "menu-text");

        label = gtk_label_new(name);
        mi = gtk_menu_item_new();

        gtk_container_add(GTK_CONTAINER(mi), label);
        
        /* ref for the menu item */
        gnome_recent_document_ref(doc);
        gtk_object_set_data_full(GTK_OBJECT(mi), "doc", 
                                 doc,
                                 (GtkDestroyNotify)gnome_recent_document_unref);

        gtk_object_set_data(GTK_OBJECT(mi), "label", label);
        
        gtk_widget_show_all(mi);

        g_hash_table_insert(doc_to_menuitem, doc, mi);
        
        /* FIXME actually we'd want to sort by time... */
        gtk_menu_shell_append(GTK_MENU_SHELL (menu), mi);
}
Пример #29
0
/*
 * Creates a new GtkWidget of class GtkInputDialog, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
GtkWidget*
gb_input_dialog_new (GbWidgetNewData *data)
{
  GtkWidget *new_widget = gtk_input_dialog_new ();

  GtkInputDialog *inputdlg = GTK_INPUT_DIALOG (new_widget);

  /* We want it to be treated as a normal window. */
  gtk_window_set_type_hint (GTK_WINDOW (new_widget),
			    GDK_WINDOW_TYPE_HINT_NORMAL);

  gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
		      GTK_SIGNAL_FUNC (editor_close_window), NULL);

  gb_widget_create_from (inputdlg->save_button,
			 data->action == GB_CREATING ? "save_button" : NULL);
  gb_widget_set_child_name (inputdlg->save_button, GladeChildSaveButton);
  /* We need to set it sensitive so the user can select it. */
  gtk_widget_set_sensitive (inputdlg->save_button, TRUE);

  gb_widget_create_from (inputdlg->close_button,
			 data->action == GB_CREATING ? "close_button" : NULL);
  gb_widget_set_child_name (inputdlg->close_button, GladeChildCloseButton);

  gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
		       GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));

  return new_widget;
}
Пример #30
0
/**
 * Sets up the icon and canvas widgets.  This function was
 * generated by glade separatly from the main gui since the icon
 * widgets are independent of the rest of the gui, and there
 * are unresolved issues between GTK and GTK2.
 */
static void
create_icon(void)
{
    icon = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_name(icon, "icon");
    gtk_object_set_data(GTK_OBJECT(icon), "icon", icon);
    gtk_widget_set_usize(icon, ICON_WIDTH + 1, ICON_HEIGHT + 1);
    gtk_widget_set_sensitive(icon, FALSE);
    GTK_WIDGET_SET_FLAGS(icon, GTK_CAN_FOCUS);
    GTK_WIDGET_SET_FLAGS(icon, GTK_CAN_DEFAULT);
    gtk_widget_set_events(icon, GDK_VISIBILITY_NOTIFY_MASK);
    gtk_window_set_title(GTK_WINDOW(icon), "icon");
    gtk_window_set_default_size(GTK_WINDOW(icon),
                                ICON_WIDTH + 1, ICON_HEIGHT + 1);
    gtk_window_set_policy(GTK_WINDOW(icon), FALSE, FALSE, FALSE);

    canvas = gtk_drawing_area_new();
    gtk_widget_set_name(canvas, "canvas");
    gtk_widget_ref(canvas);
    gtk_object_set_data_full(GTK_OBJECT(icon), "canvas", canvas,
                             (GtkDestroyNotify) gtk_widget_unref);
    gtk_widget_show(canvas);
    gtk_container_add(GTK_CONTAINER(icon), canvas);
    gtk_widget_set_events(canvas, GDK_EXPOSURE_MASK);

    gui_signal_connect(icon, "map_event", on_icon_map_event, NULL);
    gui_signal_connect(icon, "unmap_event", on_icon_unmap_event, NULL);
    gui_signal_connect(canvas, "expose_event", on_canvas_expose_event, NULL);
}