Example #1
0
void
GtkNoCodecsUI::AdaptToParentWindow ()
{
	// try to find a parent for our window
	// there must be a better way of doing this though :|
	GList *toplevels = gtk_window_list_toplevels ();
	GList *current = toplevels;
	GtkWindow *parent = NULL;

	while (current != NULL) {
		const char *title = gtk_window_get_title (GTK_WINDOW (current->data));
		if (title != NULL && strstr (title, "Mozilla Firefox") != NULL) {
			parent = GTK_WINDOW (current->data);
			break;
		}

		current = current->next;
	}
	g_list_free (toplevels);

	if (parent != NULL) {
		gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
		gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
	} else {
		// If no parent could be found, just center in the screen
		gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
	}
}
// MENU STUFF
void file_saveas()
{
	GtkWidget *dialog = gtk_file_chooser_dialog_new("Save Wad",
													NULL,
													GTK_FILE_CHOOSER_ACTION_SAVE,
													GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
													GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
													NULL);

	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
	{
		string filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
		
		if (!g_str_has_suffix(filename.c_str(), ".wad"))
			filename += ".wad";

		edit_wad = new Wad();
		edit_wad->path = filename;
		map.add_to_wad(edit_wad);
		edit_wad->save(true);
		gtk_window_set_title(GTK_WINDOW(editor_window), parse_string("SLADE (%s, %s)", edit_wad->path.c_str(), map.name.c_str()).c_str());
		add_recent_wad(filename);

		map.changed = (map.changed & ~MC_SAVE_NEEDED);
		string title = gtk_window_get_title(GTK_WINDOW(editor_window));
		if (g_str_has_suffix(title.c_str(), "*"))
			title.erase(title.size() - 1, 1);
		gtk_window_set_title(GTK_WINDOW(editor_window), title.c_str());
	}

	gtk_widget_destroy(dialog);
}
Example #3
0
static void
gail_window_real_notify_gtk (GObject		*obj,
                             GParamSpec		*pspec)
{
  GtkWidget *widget = GTK_WIDGET (obj);
  AtkObject* atk_obj = gtk_widget_get_accessible (widget);
  GailWindow *window = GAIL_WINDOW (atk_obj);
  const gchar *name;
  gboolean name_changed = FALSE;

  if (strcmp (pspec->name, "title") == 0)
    {
      name = gtk_window_get_title (GTK_WINDOW (widget));
      if (name)
        {
         if (window->previous_name == NULL ||
             strcmp (name, window->previous_name) != 0)
           name_changed = TRUE;
        }
      else if (window->previous_name != NULL)
        name_changed = TRUE;

      if (name_changed)
        {
          g_free (window->previous_name);
          window->previous_name = g_strdup (name);
       
          if (window->name_change_handler == 0)
            window->name_change_handler = gdk_threads_add_idle (idle_notify_name_change, atk_obj);
        }
    }
  else
    GAIL_WIDGET_CLASS (gail_window_parent_class)->notify_gtk (obj, pspec);
}
Example #4
0
JNIEXPORT jstring JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1get_1title
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	const gchar* result;
	jstring _result;
	GtkWindow* self;

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

	// call function
	result = gtk_window_get_title(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jstring) bindings_java_newString(env, result);

	// and finally
	return _result;
}
Example #5
0
static gint
luaH_window_index(lua_State *L, luakit_token_t token)
{
    widget_t *w = luaH_checkwidget(L, 1);

    switch(token)
    {
      LUAKIT_WIDGET_BIN_INDEX_COMMON
      LUAKIT_WIDGET_CONTAINER_INDEX_COMMON

      /* push widget class methods */
      PF_CASE(DESTROY, luaH_widget_destroy)
      PF_CASE(FOCUS,   luaH_widget_focus)
      PF_CASE(HIDE,    luaH_widget_hide)

      /* push window class methods */
      PF_CASE(SET_DEFAULT_SIZE, luaH_window_set_default_size)
      PF_CASE(SHOW,             luaH_window_show)

      /* push string methods */
      PS_CASE(TITLE, gtk_window_get_title(GTK_WINDOW(w->widget)))

      case L_TK_XID:
        lua_pushnumber(L, GDK_WINDOW_XID(GTK_WIDGET(w->widget)->window));
        return 1;

      default:
        break;
    }
    return 0;
}
Example #6
0
static void
gail_window_real_initialize (AtkObject *obj,
                             gpointer  data)
{
  GtkWidget *widget = GTK_WIDGET (data);
  GailWindow *window;

  /*
   * A GailWindow can be created for a GtkHandleBox or a GtkWindow
   */
  if (!GTK_IS_WINDOW (widget) &&
      !GTK_IS_HANDLE_BOX (widget))
    gail_return_if_fail (FALSE);

  ATK_OBJECT_CLASS (gail_window_parent_class)->initialize (obj, data);

  window = GAIL_WINDOW (obj);
  window->name_change_handler = 0;
  window->previous_name = g_strdup (gtk_window_get_title (GTK_WINDOW (data)));

  g_signal_connect (data,
                    "window_state_event",
                    G_CALLBACK (gail_window_state_event_gtk),
                    NULL);
  g_object_set_data (G_OBJECT (obj), "atk-component-layer",
                     GINT_TO_POINTER (ATK_LAYER_WINDOW));

  if (GTK_IS_FILE_SELECTION (widget))
    obj->role = ATK_ROLE_FILE_CHOOSER;
  else if (GTK_IS_COLOR_SELECTION_DIALOG (widget))
    obj->role = ATK_ROLE_COLOR_CHOOSER;
  else if (GTK_IS_FONT_SELECTION_DIALOG (widget))
    obj->role = ATK_ROLE_FONT_CHOOSER;
  else if (GTK_IS_MESSAGE_DIALOG (widget))
    obj->role = ATK_ROLE_ALERT;
  else if (GTK_IS_DIALOG (widget))
    obj->role = ATK_ROLE_DIALOG;
  else
    {
      const gchar *name;

      name = gtk_widget_get_name (widget);
      if (name && (!strcmp (name, "gtk-tooltip") ||
                   !strcmp (name, "gtk-tooltips")))
        obj->role = ATK_ROLE_TOOL_TIP;
      else if (GTK_IS_PLUG (widget))
        obj->role = ATK_ROLE_PANEL;
      else if (GTK_WINDOW (widget)->type == GTK_WINDOW_POPUP)
        obj->role = ATK_ROLE_WINDOW;
      else
        obj->role = ATK_ROLE_FRAME;
    }

  /*
   * Notify that tooltip is showing
   */
  if (obj->role == ATK_ROLE_TOOL_TIP &&
      gtk_widget_get_mapped (widget))
    atk_object_notify_state_change (obj, ATK_STATE_SHOWING, 1);
}
Example #7
0
static void
windows_actions_dock_window_notify (GimpDockWindow   *dock_window,
                                    const GParamSpec *pspec,
                                    GimpActionGroup  *group)
{
  GtkAction *action;
  gchar     *action_name;

  action_name = windows_actions_dock_window_to_action_name (dock_window);
  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
  g_free (action_name);

  if (action)
    g_object_set (action,
                  "label",   gtk_window_get_title (GTK_WINDOW (dock_window)),
                  "tooltip", gtk_window_get_title (GTK_WINDOW (dock_window)),
                  NULL);
}
Example #8
0
static char* gtkDialogGetTitleAttrib(Ihandle* ih)
{
  const char* title = gtk_window_get_title((GtkWindow*)ih->handle);

  if (!title || title[0] == 0)
    return NULL;
  else
    return iupStrGetMemoryCopy(iupgtkStrConvertFromUTF8(title));
}    
Example #9
0
/**
 * Create a conversation window and merge it with the given Buddy List window
 *
 * This is the real core of the plugin right here.  It initializes the Buddy
 * List with a conversation window just like the project advertises.  See the
 * function pwm_split_conversation() to reverse this effect.
 *
 * @param[in] gtkblist   The Buddy List that will be able to show conversations
**/
void pwm_merge_conversation(PidginBuddyList *gtkblist)
{
	PidginWindow *
	    gtkconvwin; /*< The mutilated conversations for gtkblist */
	GtkBindingSet *binding_set; /*< The binding set of GtkIMHtml widgets */

	/* Sanity check: If the Buddy List is already merged, don't mess with
	 * it. */
	if (pwm_blist_get_convs(gtkblist) != NULL)
		return;

	binding_set =
	    gtk_binding_set_by_class(g_type_class_ref(GTK_TYPE_IMHTML));
	gtkconvwin = pidgin_conv_window_new();

	/* Tie the Buddy List and conversation window instances together. */
	g_object_set_data(G_OBJECT(gtkblist->notebook), "pwm_convs",
			  gtkconvwin);
	g_object_set_data(G_OBJECT(gtkconvwin->notebook), "pwm_blist",
			  gtkblist);

	/* Backup the Buddy List window title for restoring it later. */
	pwm_store(gtkblist, "title",
		  g_strdup(gtk_window_get_title(GTK_WINDOW(gtkblist->window))));

	/* Move the conversation notebook into the Buddy List window. */
	pwm_create_paned_layout(gtkblist, purple_prefs_get_string(PREF_SIDE));

	/* Display the instructions tab for new users. */
	pwm_init_dummy_conversation(gtkblist);
	pwm_show_dummy_conversation(gtkblist);

	/* Pass focus events from Buddy List to conversation window. */
	g_object_connect(G_OBJECT(gtkblist->window), "signal::focus-in-event",
			 G_CALLBACK(focus_in_event_cb), gtkconvwin->window,
			 NULL);

	/* Point the conversation window structure at the Buddy List's window.
	 */
	pwm_store(gtkblist, "conv_window", gtkconvwin->window);
	gtkconvwin->window = gtkblist->window;

	/* Block these "move-cursor" bindings for conversation event handlers.
	 */
	/* XXX: These are skipped in any GtkIMHtml, not just the conversations.
	 */
	/* XXX: Furthermore, there is no event to undo this effect. */
	gtk_binding_entry_skip(binding_set, GDK_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Page_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Page_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_Tab, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_KP_Tab, GDK_CONTROL_MASK);
	gtk_binding_entry_skip(binding_set, GDK_ISO_Left_Tab, GDK_CONTROL_MASK);
}
NS_IMETHODIMP Icon::Init(nsIDOMWindow *aWindow, const nsString& aTitle)
{
  nsresult rv;
  nsCOMPtr<nsIBaseWindow> baseWindow;
  rv = GetBaseWindow(aWindow, getter_AddRefs(baseWindow));
  NS_ENSURE_SUCCESS(rv, rv);

  nativeWindow native = 0;
  rv = baseWindow->GetParentNativeWindow(&native);
  NS_ENSURE_SUCCESS(rv, rv);

  // Get the window
  mGdkWindow = gdk_window_get_toplevel(reinterpret_cast<GdkWindow*>(native));
  if (!mGdkWindow) {
    return NS_ERROR_UNEXPECTED;
  }

  // Get the widget and gtk window
  GtkWidget *widget;
  gdk_window_get_user_data(mGdkWindow, reinterpret_cast<gpointer*>(&widget));
  widget = gtk_widget_get_toplevel(widget);
  mGtkWindow = reinterpret_cast<GtkWindow*>(widget);

  // Set up tray icon
  mStatusIcon = gtk_status_icon_new();

  // Get the window icon and set it
  GdkPixbuf *buf = gtk_window_get_icon(mGtkWindow);
  if (buf) {
    gtk_status_icon_set_from_pixbuf(mStatusIcon, buf);
  } else {
    const gchar *iconname = gtk_window_get_icon_name(mGtkWindow);
    if (iconname)
      gtk_status_icon_set_from_icon_name(mStatusIcon, iconname);
  }

  // Get and set the title
  if (aTitle.IsEmpty()) {
    gtk_status_icon_set_tooltip_text(mStatusIcon, gtk_window_get_title(mGtkWindow));
    gtk_widget_add_events(widget, GDK_PROPERTY_CHANGE_MASK);
    propertyEventId = g_signal_connect(mGtkWindow, "property-notify-event", G_CALLBACK(gtkPropertyEvent), this);
  }
  else {
    NS_ConvertUTF16toUTF8 titleUTF8(aTitle);
    gtk_status_icon_set_tooltip_text(mStatusIcon, reinterpret_cast<const char*>(titleUTF8.get()));
    propertyEventId = 0;
  }

  // Add signals
  g_signal_connect(G_OBJECT(mStatusIcon), "button-press-event", G_CALLBACK(gtkButtonEvent), this);
  g_signal_connect(G_OBJECT(mStatusIcon), "button-release-event", G_CALLBACK(gtkButtonEvent), this);

  // Make visible
  gtk_status_icon_set_visible(mStatusIcon, 1);
  return NS_OK;
}
Example #11
0
/**
 * e_webdav_discover_dialog_refresh:
 * @dialog: a #GtkDialog returned by e_webdav_discover_dialog_new()
 *
 * Invokes refresh of the inner content of the WebDAV discovery dialog.
 *
 * Since: 3.18
 **/
void
e_webdav_discover_dialog_refresh (GtkDialog *dialog)
{
	GtkWidget *content;

	g_return_if_fail (GTK_IS_DIALOG (dialog));

	content = g_object_get_data (G_OBJECT (dialog), WEBDAV_DISCOVER_CONTENT_KEY);
	g_return_if_fail (content != NULL);

	e_webdav_discover_content_refresh (content, gtk_window_get_title (GTK_WINDOW (dialog)),
		NULL, e_webdav_discover_content_dialog_refresh_done_cb, NULL);
}
Example #12
0
struct point_2d getpoint(GtkWidget *widget){
  struct get_point_data data;
  gchar* old_title = g_strdup(gtk_window_get_title(GTK_WINDOW(widget)));
  gtk_window_set_title (GTK_WINDOW (widget), "Select a point:");
  fprintf(stderr, "in getpoint\n");
  data.button_press_handler_id =
    g_signal_connect(G_OBJECT(widget), "button-press-event",
      G_CALLBACK(get_point_button_press), &data);
  gtk_main();
  gtk_window_set_title (GTK_WINDOW (widget), old_title);
  g_free(old_title);
  return data.point;
}
Example #13
0
static void
setup_header_bar (GtkWidget   *window,
                  VteTerminal *vtterm,
                  gboolean     show_maximized_title)
{
    /*
     * Using the default GtkHeaderBar title/subtitle widget makes the bar
     * too thick to look nice for a terminal, so set a custom widget.
     */
    GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
    const gchar *title = gtk_window_get_title (GTK_WINDOW (window));
    GtkWidget *label = gtk_label_new (title ? title : "dwt");
    g_object_bind_property (G_OBJECT (vtterm), "window-title",
                            G_OBJECT (label), "label",
                            G_BINDING_DEFAULT);

    GtkWidget *header = gtk_header_bar_new ();
    gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
    gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header), FALSE);
    gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header), label);

    GtkWidget *button = gtk_button_new_from_icon_name ("tab-new-symbolic",
                                                       GTK_ICON_SIZE_BUTTON);
    gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
    gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.new-terminal");
    gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);

    GtkWidget *revealer = gtk_revealer_new ();
    gtk_container_add (GTK_CONTAINER (revealer),
                       gtk_image_new_from_icon_name ("software-update-urgent-symbolic",
                                                     GTK_ICON_SIZE_BUTTON));
    gtk_revealer_set_transition_duration (GTK_REVEALER (revealer), 500);
    gtk_revealer_set_transition_type (GTK_REVEALER (revealer),
                                      GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
    gtk_header_bar_pack_end (GTK_HEADER_BAR (header), revealer);

    g_signal_connect (G_OBJECT (vtterm), "bell",
                      G_CALLBACK (header_bar_term_beeped), revealer);
    g_object_bind_property (G_OBJECT (window), "urgency-hint",
                            G_OBJECT (revealer), "reveal-child",
                            G_BINDING_DEFAULT);

    gtk_window_set_titlebar (GTK_WINDOW (window), header);

    /* Hide the header bar when the window is maximized. */
    if (!show_maximized_title) {
        g_object_bind_property (G_OBJECT (window), "is-maximized",
                                G_OBJECT (header), "visible",
                                G_BINDING_INVERT_BOOLEAN);
    }
}
Example #14
0
void Map::change_level(BYTE flags)
{
    if (!(changed & MC_SAVE_NEEDED))
    {
        string title = gtk_window_get_title(GTK_WINDOW(editor_window));
        title += "*";
        gtk_window_set_title(GTK_WINDOW(editor_window), title.c_str());
    }

    if (flags & MC_NODE_REBUILD)
        flags |= MC_SSECTS|MC_LINES;

    changed |= MC_SAVE_NEEDED;	// If anything changes a save is needed
    changed |= flags;
}
Example #15
0
static void
handle_count_title(PidginWindow *purplewin)
{
	GtkWindow *window;
	char newtitle[256];

	g_return_if_fail(purplewin != NULL);

	window = GTK_WINDOW(purplewin->window);
	g_return_if_fail(window != NULL);

	g_snprintf(newtitle, sizeof(newtitle), "[%d] %s",
	           count_messages(purplewin), gtk_window_get_title(window));
	gtk_window_set_title(window, newtitle);
}
void file_save()
{
	if (!edit_wad->locked)
	{
		map.add_to_wad(edit_wad);
		edit_wad->save(true);
	}
	else
		file_saveas();

	map.changed = (map.changed & ~MC_SAVE_NEEDED);
	string title = gtk_window_get_title(GTK_WINDOW(editor_window));
	if (g_str_has_suffix(title.c_str(), "*"))
		title.erase(title.size() - 1, 1);
	gtk_window_set_title(GTK_WINDOW(editor_window), title.c_str());
}
Example #17
0
static void
handle_string(PidginWindow *purplewin)
{
	GtkWindow *window = NULL;
	gchar newtitle[256];

	g_return_if_fail(purplewin != NULL);

	window = GTK_WINDOW(purplewin->window);
	g_return_if_fail(window != NULL);

	g_snprintf(newtitle, sizeof(newtitle), "%s%s",
	           purple_prefs_get_string("/plugins/gtk/X11/notify/title_string"),
	           gtk_window_get_title(window));
	gtk_window_set_title(window, newtitle);
}
Example #18
0
static GtkWidget*
setup_tooltip_window(void)
{
	const char *name;
	GtkWidget *tipwindow;

	tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
	name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget));
	gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP);
	gtk_widget_set_app_paintable(tipwindow, TRUE);
	gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : g_strdup_printf(_("%s Tooltip"), APPLICATION_NAME));
	gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE);
	gtk_widget_set_name(tipwindow, "gtk-tooltips");
	gtk_widget_ensure_style(tipwindow);
	gtk_widget_realize(tipwindow);
	return tipwindow;
}
Example #19
0
static GtkWidget*
setup_tooltip_window(void)
{
	const char *name;
	GtkWidget *tipwindow;

	tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
	name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget));
#if GTK_CHECK_VERSION(2,10,0)
	gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP);
#endif
	gtk_widget_set_app_paintable(tipwindow, TRUE);
	gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip"));
	gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE);
	gtk_widget_set_name(tipwindow, "gtk-tooltips");
	gtk_widget_ensure_style(tipwindow);
	gtk_widget_realize(tipwindow);
	return tipwindow;
}
Example #20
0
void widget_window_save(variable *var)
{
	FILE             *outfile;
	GList            *element;
	gchar            *act;
	gchar            *filename = NULL;

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Entering.\n", __func__);
#endif

	/* We'll use the output file filename if available */
	act = attributeset_get_first(&element, var->Attributes, ATTR_OUTPUT);
	while (act) {
		if (strncasecmp(act, "file:", 5) == 0 && strlen(act) > 5) {
			filename = act + 5;
			break;
		}
		act = attributeset_get_next(&element, var->Attributes, ATTR_OUTPUT);
	}

	/* If we have a valid filename then open it and dump the
	 * widget's data to it */
	if (filename) {
		if ((outfile = fopen(filename, "w"))) {
			fprintf(outfile, "%s", gtk_window_get_title(GTK_WINDOW(var->Widget)));
			/* Close the file */
			fclose(outfile);
		} else {
			fprintf(stderr, "%s(): Couldn't open '%s' for writing.\n",
				__func__, filename);
		}
	} else {
		fprintf(stderr, "%s(): No <output file> directive found.\n", __func__);
	}

#ifdef DEBUG_TRANSITS
	fprintf(stderr, "%s(): Exiting.\n", __func__);
#endif
}
Example #21
0
/*
 * This handler takes title of the editor window and
 * inserts information about number of processed mails and
 * number of all mails to process, so the window title
 * will look like "Appointment (3/10) - An appoitment name"
 */
static void
comp_editor_title_changed (GtkWidget *widget,
                           GParamSpec *pspec,
                           struct _manage_comp *mc)
{
	GtkWindow *editor = GTK_WINDOW (widget);
	const gchar *title = gtk_window_get_title (editor);
	gchar *new_title;
	gchar *splitter;
	gchar *comp_name, *task_name;

	if (!mc)
		return;

	/* Recursion prevence */
	if (mc->editor_title && g_utf8_collate (mc->editor_title, title) == 0)
		return;

	splitter = strchr (title, '-');
	if (!splitter)
		return;

	comp_name = g_strndup (title, splitter - title - 1);
	task_name = g_strdup (splitter + 2);
	new_title = g_strdup_printf (
		"%s (%d/%d) - %s",
		comp_name, mc->mails_done, mc->mails_count, task_name);

	/* Remember the new title, so that when gtk_window_set_title() causes
	 * this handler to be recursively called, we can recognize that and
	 * prevent endless recursion */
	if (mc->editor_title)
		g_free (mc->editor_title);
	mc->editor_title = new_title;

	gtk_window_set_title (editor, new_title);

	g_free (comp_name);
	g_free (task_name);
}
Example #22
0
void gui_show_message_box(gint type, gpointer signal)
{
    GtkWidget *warning = NULL;
    gchar *txt = ((GGaduSignal *) signal)->data;
    gchar *title;
    gui_protocol *gp;

    warning = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_CLOSE, txt);

    gp = gui_find_protocol(((GGaduSignal *) signal)->source_plugin_name, protocols);

	/* *INDENT-OFF* */
	title = g_strdup_printf("%s: %s", (gp) ? gp->p->display_name : (char *) ((GGaduSignal *) signal)->source_plugin_name,
			gtk_window_get_title(GTK_WINDOW(warning)));
	/* *INDENT-ON* */

    gtk_window_set_title(GTK_WINDOW(warning), title);
    gtk_widget_show_all(warning);
    g_signal_connect_swapped(GTK_OBJECT(warning), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(warning));
    g_free(txt);		/* ZONK there shouldnt be free(txt) imho */
//      g_free(title);          because of void gtk_window_set_title (GtkWindow *window, const gchar *title);
}
Example #23
0
static gboolean remmina_icon_foreach_window(GtkWidget *widget, gpointer data)
{
	GtkWidget *popup_menu = GTK_WIDGET(data);
	GtkWidget *menuitem;
	GdkScreen *screen;
	gint screen_number;

	if (G_TYPE_CHECK_INSTANCE_TYPE(widget, REMMINA_TYPE_CONNECTION_WINDOW))
	{
		screen = gdk_screen_get_default();
		screen_number = gdk_screen_get_number(screen);
		if (screen_number == gdk_screen_get_number(gtk_window_get_screen(GTK_WINDOW(widget))))
		{
			menuitem = gtk_menu_item_new_with_label(gtk_window_get_title(GTK_WINDOW(widget)));
			gtk_widget_show(menuitem);
			gtk_menu_shell_prepend(GTK_MENU_SHELL(popup_menu), menuitem);
			g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(remmina_icon_on_activate_window), widget);
			return TRUE;
		}
	}
	return FALSE;
}
Example #24
0
static gint
luaH_window_index(lua_State *L, luapdf_token_t token)
{
    widget_t *w = luaH_checkwidget(L, 1);

    switch(token)
    {
      LUAPDF_WIDGET_BIN_INDEX_COMMON(w)
      LUAPDF_WIDGET_CONTAINER_INDEX_COMMON(w)

      /* push widget class methods */
      PF_CASE(DESTROY, luaH_widget_destroy)
      PF_CASE(FOCUS,   luaH_widget_focus)
      PF_CASE(HIDE,    luaH_widget_hide)

      /* push window class methods */
      PF_CASE(SET_DEFAULT_SIZE, luaH_window_set_default_size)
      PF_CASE(SHOW,             luaH_window_show)
      PF_CASE(SET_SCREEN,       luaH_window_set_screen)
      PF_CASE(FULLSCREEN,       luaH_window_fullscreen)
      PF_CASE(UNFULLSCREEN,     luaH_window_unfullscreen)
      PF_CASE(MAXIMIZE,         luaH_window_maximize)
      PF_CASE(UNMAXIMIZE,       luaH_window_unmaximize)

      /* push string methods */
      PS_CASE(TITLE, gtk_window_get_title(GTK_WINDOW(w->widget)))

      /* push boolean properties */
      PB_CASE(DECORATED, gtk_window_get_decorated(GTK_WINDOW(w->widget)))

      case L_TK_XID:
        lua_pushnumber(L, GDK_WINDOW_XID(GTK_WIDGET(w->widget)->window));
        return 1;

      default:
        break;
    }
    return 0;
}
Example #25
0
static PyObject* ComposeWindow_set_modified(clawsmail_ComposeWindowObject *self, PyObject *args)
{
  char modified = 0;
  gboolean old_modified;

  if(!PyArg_ParseTuple(args, "b", &modified))
    return NULL;

  old_modified = self->compose->modified;

  self->compose->modified = (modified != 0);

  /* If the modified state changed, rewrite window title.
   * This partly duplicates functionality in compose.c::compose_set_title().
   * While it's nice to not have to modify Claws Mail for this to work,
   * it would be cleaner to export that function in Claws Mail. */
  if((strcmp(gtk_window_get_title(GTK_WINDOW(self->compose->window)), _("Compose message")) != 0) &&
      (old_modified != self->compose->modified)) {
      gchar *str;
      gchar *edited;
      gchar *subject;

      edited = self->compose->modified  ? _(" [Edited]") : "";
      subject = gtk_editable_get_chars(GTK_EDITABLE(self->compose->subject_entry), 0, -1);
      if(subject && strlen(subject))
        str = g_strdup_printf(_("%s - Compose message%s"),
            subject, edited);
      else
        str = g_strdup_printf(_("[no subject] - Compose message%s"), edited);
      gtk_window_set_title(GTK_WINDOW(self->compose->window), str);
      g_free(str);
      g_free(subject);
  }

  flush_gtk_queue();

  Py_INCREF(Py_None);
  return Py_None;
}
Example #26
0
static void
windows_actions_dock_window_added (GimpDialogFactory *factory,
                                   GimpDockWindow    *dock_window,
                                   GimpActionGroup   *group)
{
  GtkAction       *action;
  GimpActionEntry  entry;
  gchar           *action_name = windows_actions_dock_window_to_action_name (dock_window);

  entry.name        = action_name;
  entry.stock_id    = NULL;
  entry.label       = "";
  entry.accelerator = NULL;
  entry.tooltip     = NULL;
  entry.callback    = G_CALLBACK (windows_show_dock_cmd_callback);
  entry.help_id     = GIMP_HELP_WINDOWS_SHOW_DOCK;

  gimp_action_group_add_actions (group, NULL, &entry, 1);

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

  g_object_set (action,
                "ellipsize", PANGO_ELLIPSIZE_END,
                NULL);

  g_object_set_data (G_OBJECT (action), "dock-window", dock_window);

  g_free (action_name);

  g_signal_connect_object (dock_window, "notify::title",
                           G_CALLBACK (windows_actions_dock_window_notify),
                           group, 0);

  if (gtk_window_get_title (GTK_WINDOW (dock_window)))
    windows_actions_dock_window_notify (dock_window, NULL, group);
}
Example #27
0
E8::Variant GtkPortWindow::GetTitle() const
{
    return E8::string(gtk_window_get_title(obj));
}
Example #28
0
char *uiWindowTitle(uiWindow *w)
{
	return uiUnixStrdupText(gtk_window_get_title(w->window));
}
Example #29
0
/********************************
* Meg_MapSection_Close
*
*/
gboolean Meg_MapSection_Close( GtkWidget *widget, GdkEvent *event, gpointer user_data )
{
	gint result = 0;
	GtkWidget * dialog = gtk_message_dialog_new( Meg_Misc_ParentWindow( widget ), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "Save '%s'", gtk_window_get_title( GTK_WINDOW(widget) ) );
	gtk_dialog_add_buttons( GTK_DIALOG(dialog), GTK_STOCK_YES, 1, GTK_STOCK_NO, 2, GTK_STOCK_CANCEL, 0, NULL );
	result = gtk_dialog_run( GTK_DIALOG(dialog) );
	gtk_widget_destroy( dialog );

	if ( result == 0 )
	{
		return TRUE;
	}
	else
	{
		GtkTreeIter iter;
		if ( gtk_tree_model_get_iter_from_string( GTK_TREE_MODEL(sectionFileStore), &iter,(gchar*)g_object_get_data( G_OBJECT(widget), "alchera-list-path") ) )
		{
			gtk_list_store_set( sectionFileStore, &iter, 1, "", 3, NULL, -1);
		}
		if ( result == 1 )
		{
			guint32 section_id = GPOINTER_TO_UINT( g_object_get_data( G_OBJECT(widget), "alchera-section-id" ) );
			AL_MapSection_Save( section_id, Meg_Misc_ParentWindow( widget ) );
		}
	}
	return FALSE;
}
Example #30
0
int Gtk2Gui_Dialog_Setup(GWEN_DIALOG *dlg, GtkWidget *parentWindow) {
  GTK2_GUI_DIALOG *xdlg;
  GWEN_WIDGET_TREE *wtree;
  GWEN_WIDGET *w;
  GtkWindow *gw;
  int rv;
  GList *tll;

  assert(dlg);
  xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GTK2_GUI_DIALOG, dlg);
  assert(xdlg);

  wtree=GWEN_Dialog_GetWidgets(dlg);
  if (wtree==NULL) {
    DBG_ERROR(GWEN_LOGDOMAIN, "No widget tree in dialog");
    return GWEN_ERROR_NOT_FOUND;
  }
  w=GWEN_Widget_Tree_GetFirst(wtree);
  if (w==NULL) {
    DBG_ERROR(GWEN_LOGDOMAIN, "No widgets in dialog");
    return GWEN_ERROR_NOT_FOUND;
  }

  rv=Gtk2Gui_Dialog_SetupTree(w);
  if (rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
    return rv;
  }

  gw=GTK_WINDOW(GWEN_Widget_GetImplData(w, GTK2_DIALOG_WIDGET_REAL));
  gtk_window_set_type_hint(GTK_WINDOW(gw), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_position (GTK_WINDOW (gw), GTK_WIN_POS_CENTER_ON_PARENT);
  /*gtk_window_set_keep_above(GTK_WINDOW(gw), TRUE);*/
  xdlg->mainWidget=GTK_WIDGET(gw);

  tll=gtk_window_list_toplevels();
  if (tll) {
    GList* element;
    GtkWindow *topLevel=NULL;

    for (element = tll; element; element = g_list_next(element)) {
      GtkWindow* win = GTK_WINDOW(element->data);
      if (gtk_window_is_active(win)) {
        topLevel=win;
        break;
      }
    }
    g_list_free(tll);

    if (topLevel) {
      DBG_NOTICE(GWEN_LOGDOMAIN, "Found active window [%s]",
                 gtk_window_get_title(topLevel));
      gtk_window_set_transient_for(gw, topLevel);
    }
    else {
      DBG_ERROR(GWEN_LOGDOMAIN, "No active window found...");
    }
  }

  return 0;
}