pidgin/pidgin

Parents 8dad2981fb86
Children c0ea70247280
Remove a bunch of functions from gtkutils that weren't being used.

Testing Done:
built.

Reviewed at https://reviews.imfreedom.org/r/120/
--- a/ChangeLog.API Tue Sep 15 21:54:10 2020 -0500
+++ b/ChangeLog.API Wed Sep 16 01:58:44 2020 -0500
@@ -623,6 +623,7 @@
* gtk_imhtml_image_scale
* pidgin_blist_update_account_error_state
* PidginBuddyList.connection_errors
+ * PidginButtonStyle
* pidgin_check_if_dir
* PidginConversation.sg
* PidginConvPlacementFunc
@@ -634,18 +635,25 @@
* pidgin_conv_placement_get_current_func
* pidgin_create_dialog, use pidgin_dialog_new instead.
* pidgin_create_small_button, use pidgin_close_button_new instead.
+ * pidgin_create_status_icon
* pidgin_create_window, use pidgin_window_new instead.
* PIDGIN_DIALOG
* pidgin_dialogs_alias_contact
* pidgin_make_pretty_arrows
+ * pidgin_menu_position_func_helper
* pidgin_mini_dialog_links_supported
+ * pidgin_pixbuf_toolbar_button_from_stock
+ * pidgin_protocol_option_menu_get_selected
* pidgin_set_custom_buddy_icon
+ * pidgin_set_sensitive_if_input
* pidgin_setup_screenname_autocomplete_with_filter
* pidgin_sound_get_event_label
* pidgin_sound_get_event_option
* pidgin_sound_get_handle
* pidgin_sound_get_ui_ops
* pidgin_sound_is_customized
+ * pidgin_stock_id_from_presence
+ * pidgin_text_combo_box_entry_set_text
* pidgin_toggle_sensitive, pidgin_toggle_sensitive_array, and
pidgin_toggle_showhide; use g_object_bind_property instead
* struct _GtkIMHtmlAnimation
--- a/pidgin/gtkutils.c Tue Sep 15 21:54:10 2020 -0500
+++ b/pidgin/gtkutils.c Wed Sep 16 01:58:44 2020 -0500
@@ -192,14 +192,6 @@
return button;
}
-void
-pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog)
-{
- const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
- gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_OK,
- (*text != '\0'));
-}
-
GtkWidget *pidgin_separator(GtkWidget *menu)
{
GtkWidget *menuitem;
@@ -230,26 +222,6 @@
}
GtkWidget *
-pidgin_pixbuf_toolbar_button_from_stock(const char *icon)
-{
- GtkWidget *button, *image, *bbox;
-
- button = gtk_toggle_button_new();
- gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-
- bbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-
- gtk_container_add (GTK_CONTAINER(button), bbox);
-
- image = gtk_image_new_from_stock(icon, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
- gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0);
-
- gtk_widget_show_all(bbox);
-
- return button;
-}
-
-GtkWidget *
pidgin_pixbuf_button_from_stock(const char *text, const char *icon,
PidginButtonOrientation style)
{
@@ -368,21 +340,6 @@
return vbox2;
}
-static gpointer
-aop_option_menu_get_selected(GtkWidget *optmenu)
-{
- gpointer data = NULL;
- GtkTreeIter iter;
-
- g_return_val_if_fail(optmenu != NULL, NULL);
-
- if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(optmenu), &iter))
- gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)),
- &iter, AOP_DATA_COLUMN, &data, -1);
-
- return data;
-}
-
GdkPixbuf *
pidgin_create_icon_from_protocol(PurpleProtocol *protocol, PidginProtocolIconSize size, PurpleAccount *account)
{
@@ -433,12 +390,6 @@
}
}
-const char *
-pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu)
-{
- return (const char *)aop_option_menu_get_selected(optmenu);
-}
-
void
pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
GdkModifierType arg2, GClosure *arg3,
@@ -738,129 +689,6 @@
}
void
-pidgin_menu_position_func_helper(GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer data)
-{
- GtkWidget *widget;
- GtkRequisition requisition;
- GdkMonitor *monitor = NULL;
- GdkRectangle geo;
- gint space_left, space_right, space_above, space_below;
- gboolean rtl;
-
- g_return_if_fail(GTK_IS_MENU(menu));
-
- widget = GTK_WIDGET(menu);
- rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
-
- /*
- * We need the requisition to figure out the right place to
- * popup the menu. In fact, we always need to ask here, since
- * if a size_request was queued while we weren't popped up,
- * the requisition won't have been recomputed yet.
- */
- gtk_widget_get_preferred_size(widget, NULL, &requisition);
-
- monitor = gdk_display_get_monitor_at_point(gdk_display_get_default(), *x, *y);
-
- *push_in = FALSE;
-
- /*
- * The placement of popup menus horizontally works like this (with
- * RTL in parentheses)
- *
- * - If there is enough room to the right (left) of the mouse cursor,
- * position the menu there.
- *
- * - Otherwise, if if there is enough room to the left (right) of the
- * mouse cursor, position the menu there.
- *
- * - Otherwise if the menu is smaller than the monitor, position it
- * on the side of the mouse cursor that has the most space available
- *
- * - Otherwise (if there is simply not enough room for the menu on the
- * monitor), position it as far left (right) as possible.
- *
- * Positioning in the vertical direction is similar: first try below
- * mouse cursor, then above.
- */
- gdk_monitor_get_geometry(monitor, &geo);
-
- space_left = *x - geo.x;
- space_right = geo.x + geo.width - *x - 1;
- space_above = *y - geo.y;
- space_below = geo.y + geo.height - *y - 1;
-
- /* position horizontally */
-
- if (requisition.width <= space_left ||
- requisition.width <= space_right)
- {
- if ((rtl && requisition.width <= space_left) ||
- (!rtl && requisition.width > space_right))
- {
- /* position left */
- *x = *x - requisition.width + 1;
- }
-
- /* x is clamped on-screen further down */
- }
- else if (requisition.width <= geo.width)
- {
- /* the menu is too big to fit on either side of the mouse
- * cursor, but smaller than the monitor. Position it on
- * the side that has the most space
- */
- if (space_left > space_right)
- {
- /* left justify */
- *x = geo.x;
- }
- else
- {
- /* right justify */
- *x = geo.x + geo.width - requisition.width;
- }
- }
- else /* menu is simply too big for the monitor */
- {
- if (rtl)
- {
- /* right justify */
- *x = geo.x + geo.width - requisition.width;
- }
- else
- {
- /* left justify */
- *x = geo.x;
- }
- }
-
- /* Position vertically. The algorithm is the same as above, but
- * simpler because we don't have to take RTL into account.
- */
-
- if (requisition.height <= space_above ||
- requisition.height <= space_below)
- {
- if (requisition.height > space_below) {
- *y = *y - requisition.height + 1;
- }
-
- *y = CLAMP (*y, geo.y,
- geo.y + geo.height - requisition.height);
- } else {
- if (space_below >= space_above)
- *y = geo.y + geo.height - requisition.height;
- else
- *y = geo.y;
- }
-}
-
-void
pidgin_menu_popup_at_treeview_selection(GtkWidget *menu, GtkWidget *treeview)
{
GtkTreePath *path;
@@ -1218,17 +1046,6 @@
*height = 100;
}
-GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive prim, GtkWidget *w, const char *size)
-{
- GtkIconSize icon_size = gtk_icon_size_from_name(size);
- GdkPixbuf *pixbuf = NULL;
- const char *stock = pidgin_stock_id_from_status_primitive(prim);
-
- pixbuf = gtk_widget_render_icon (w, stock ? stock : PIDGIN_STOCK_STATUS_AVAILABLE,
- icon_size, "GtkWidget");
- return pixbuf;
-}
-
static const char *
stock_id_from_status_primitive_idle(PurpleStatusPrimitive prim, gboolean idle)
{
@@ -1265,25 +1082,6 @@
return stock_id_from_status_primitive_idle(prim, FALSE);
}
-const char *
-pidgin_stock_id_from_presence(PurplePresence *presence)
-{
- PurpleStatus *status;
- PurpleStatusType *type;
- PurpleStatusPrimitive prim;
- gboolean idle;
-
- g_return_val_if_fail(presence, NULL);
-
- status = purple_presence_get_active_status(presence);
- type = purple_status_get_status_type(status);
- prim = purple_status_type_get_primitive(type);
-
- idle = purple_presence_is_idle(presence);
-
- return stock_id_from_status_primitive_idle(prim, idle);
-}
-
GdkPixbuf *
pidgin_create_protocol_icon(PurpleAccount *account, PidginProtocolIconSize size)
{
@@ -2292,11 +2090,6 @@
return gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))));
}
-void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text)
-{
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))), (text));
-}
-
GtkWidget *
pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label)
{
--- a/pidgin/gtkutils.h Tue Sep 15 21:54:10 2020 -0500
+++ b/pidgin/gtkutils.h Wed Sep 16 01:58:44 2020 -0500
@@ -45,31 +45,11 @@
typedef enum
{
- PIDGIN_BUTTON_NONE = 0,
- PIDGIN_BUTTON_TEXT,
- PIDGIN_BUTTON_IMAGE,
- PIDGIN_BUTTON_TEXT_IMAGE
-
-} PidginButtonStyle;
-
-typedef enum
-{
PIDGIN_PROTOCOL_ICON_SMALL,
PIDGIN_PROTOCOL_ICON_MEDIUM,
PIDGIN_PROTOCOL_ICON_LARGE
} PidginProtocolIconSize;
-#ifndef _WIN32
-typedef enum
-{
- PIDGIN_BROWSER_DEFAULT = 0,
- /* value '1' was used by PIDGIN_BROWSER_CURRENT, which no longer exists */
- PIDGIN_BROWSER_NEW_WINDOW = 2,
- PIDGIN_BROWSER_NEW_TAB
-
-} PidginBrowserPlace;
-#endif /* _WIN32 */
-
typedef struct {
gboolean is_buddy;
union {
@@ -139,17 +119,6 @@
GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog);
/**
- * pidgin_set_sensitive_if_input:
- * @entry: The text entry widget.
- * @dialog: The dialog containing the text entry widget.
- *
- * Checks if text has been entered into a GtkTextEntry widget. If
- * so, the GTK_RESPONSE_OK on the given dialog is set to TRUE.
- * Otherwise GTK_RESPONSE_OK is set to FALSE.
- */
-void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog);
-
-/**
* pidgin_separator:
* @menu: The menu to add a separator to.
*
@@ -204,16 +173,6 @@
PidginButtonOrientation style);
/**
- * pidgin_pixbuf_toolbar_button_from_stock:
- * @stock: The stock icon name.
- *
- * Creates a toolbar button with the stock icon.
- *
- * Returns: (transfer full): The button.
- */
-GtkWidget *pidgin_pixbuf_toolbar_button_from_stock(const char *stock);
-
-/**
* pidgin_make_frame:
* @parent: The widget to put the frame into.
* @title: The title for the frame.
@@ -225,17 +184,6 @@
GtkWidget *pidgin_make_frame(GtkWidget *parent, const char *title);
/**
- * pidgin_protocol_option_menu_get_selected:
- * @optmenu: The drop-down option menu created by
- * pidgin_protocol_option_menu_new().
- *
- * Gets the currently selected protocol from a protocol drop down box.
- *
- * Returns: Returns the protocol ID that is currently selected.
- */
-const char *pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu);
-
-/**
* pidgin_setup_screenname_autocomplete:
* @entry: The GtkEntry on which to setup autocomplete.
* @chooser: A menu for accounts, returned by pidgin_account_chooser_new(). If
@@ -348,22 +296,6 @@
void pidgin_set_accessible_relations(GtkWidget *w, GtkLabel *l);
/**
- * pidgin_menu_position_func_helper:
- * @menu: The menu we are positioning.
- * @x: Address of the gint representing the horizontal position
- * where the menu shall be drawn. This is an output parameter.
- * @y: Address of the gint representing the vertical position
- * where the menu shall be drawn. This is an output parameter.
- * @push_in: This is an output parameter?
- * @data: Not used by this particular position function.
- *
- * A helper function for GtkMenuPositionFuncs. This ensures the menu will
- * be kept on screen if possible.
- */
-void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y,
- gboolean *push_in, gpointer data);
-
-/**
* pidgin_menu_popup_at_treeview_selection:
* @menu: The menu to show.
* @treeview: The treeview to use for positioning.
@@ -430,18 +362,6 @@
GdkPixbuf *pidgin_create_icon_from_protocol(PurpleProtocol *protocol, PidginProtocolIconSize size, PurpleAccount *account);
/**
- * pidgin_create_status_icon:
- * @primitive: The status primitive
- * @w: The widget to render this
- * @size: The icon size to render at
- *
- * Creates a status icon for a given primitve
- *
- * Returns: (transfer full): A GdkPixbuf, created from stock
- */
-GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget *w, const char *size);
-
-/**
* pidgin_stock_id_from_status_primitive:
* @prim: The status primitive
*
@@ -452,16 +372,6 @@
const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim);
/**
- * pidgin_stock_id_from_presence:
- * @presence: The presence.
- *
- * Returns an appropriate stock-id for a PurplePresence.
- *
- * Returns: The stock-id
- */
-const char *pidgin_stock_id_from_presence(PurplePresence *presence);
-
-/**
* pidgin_append_menu_action:
* @menu: The menu to append to.
* @act: The PurpleActionMenu to append.
@@ -651,15 +561,6 @@
const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget);
/**
- * pidgin_text_combo_box_entry_set_text:
- * @widget: The simple text GtkComboBoxEntry equivalent widget
- * @text: The text to set
- *
- * Set the text in the entry of the simple text GtkComboBoxEntry equivalent
- */
-void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text);
-
-/**
* pidgin_auto_parent_window:
* @window: The window to make transient.
*