summaryrefslogtreecommitdiff
path: root/frontends/gtk/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/gtk/compat.h')
-rw-r--r--frontends/gtk/compat.h47
1 files changed, 36 insertions, 11 deletions
diff --git a/frontends/gtk/compat.h b/frontends/gtk/compat.h
index 9554b0cba..3b2f55094 100644
--- a/frontends/gtk/compat.h
+++ b/frontends/gtk/compat.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Compatibility functions for older GTK versions (interface)
*/
@@ -40,9 +41,6 @@
#define NSGTK_STOCK_CANCEL "_Cancel"
#define NSGTK_STOCK_CLEAR "edit-clear"
#define NSGTK_STOCK_CLOSE "window-close"
-#define NSGTK_STOCK_FIND "edit-find"
-#define NSGTK_STOCK_GO_BACK "go-previous"
-#define NSGTK_STOCK_GO_FORWARD "go-next"
#define NSGTK_STOCK_HOME "go-home"
#define NSGTK_STOCK_INFO "dialog-information"
#define NSGTK_STOCK_REFRESH "view-refresh"
@@ -51,14 +49,12 @@
#define NSGTK_STOCK_STOP "process-stop"
#define NSGTK_STOCK_OK "_OK"
#define NSGTK_STOCK_OPEN "_Open"
+#define NSGTK_STOCK_OPEN_MENU "open-menu"
#else
#define NSGTK_STOCK_ADD GTK_STOCK_ADD
#define NSGTK_STOCK_CANCEL GTK_STOCK_CANCEL
#define NSGTK_STOCK_CLEAR GTK_STOCK_CLEAR
#define NSGTK_STOCK_CLOSE GTK_STOCK_CLOSE
-#define NSGTK_STOCK_FIND GTK_STOCK_FIND
-#define NSGTK_STOCK_GO_BACK GTK_STOCK_GO_BACK
-#define NSGTK_STOCK_GO_FORWARD GTK_STOCK_GO_FORWARD
#define NSGTK_STOCK_HOME GTK_STOCK_HOME
#define NSGTK_STOCK_INFO GTK_STOCK_INFO
#define NSGTK_STOCK_REFRESH GTK_STOCK_REFRESH
@@ -67,6 +63,7 @@
#define NSGTK_STOCK_STOP GTK_STOCK_STOP
#define NSGTK_STOCK_OK GTK_STOCK_OK
#define NSGTK_STOCK_OPEN GTK_STOCK_OPEN
+#define NSGTK_STOCK_OPEN_MENU GTK_STOCK_JUSTIFY_FILL
#endif
/* widget alignment only available since 3.0 */
@@ -80,6 +77,12 @@ typedef enum {
} GtkAlign;
#endif
+/* value init since gtk 2.30 */
+#ifndef G_VALUE_INIT
+#define G_VALUE_INIT { 0, { { 0 } } }
+#endif
+
+
/**
* Set the alignment of a widget.
*
@@ -153,6 +156,9 @@ GtkStateType nsgtk_widget_get_state(GtkWidget *widget);
typedef GtkStateType GtkStateFlags;
typedef GtkStyle GtkStyleContext;
+/* gtk 3 changed the enum name for the state flags */
+#define GTK_STATE_FLAG_NORMAL GTK_STATE_NORMAL
+
#if GTK_CHECK_VERSION(2,22,0)
enum {
GTK_IN_DESTRUCTION = 1 << 0,
@@ -167,16 +173,16 @@ enum {
/**
- * Sets the icon shown in the entry at the specified position from a
- * stock image.
+ * Sets the icon shown in the entry at the specified position from an
+ * icon name.
*
- * Compatability interface for original deprecated in GTK 3.10
+ * Compatability interface for original introduced in 2.16
*
* \param entry The entry widget to set the icon on.
* \param icon_pos The position of the icon.
* \param stock_id the name of the stock item.
*/
-void nsgtk_entry_set_icon_from_stock(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id);
+void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *stock_id);
/**
* Creates a GtkImage displaying a stock icon.
@@ -209,6 +215,16 @@ GtkWidget *nsgtk_button_new_from_stock(const gchar *stock_id);
*/
gboolean nsgtk_stock_lookup(const gchar *stock_id, GtkStockItem *item);
+/**
+ * Sets whether the button will grab focus when it is clicked with the mouse.
+ *
+ * Compatability interface for original deprecated in GTK 3.20
+ *
+ * \param button The button alter
+ * \param focus_on_click whether the button grabs focus when clicked with the mouse
+ */
+void nsgtk_button_set_focus_on_click(GtkButton *button, gboolean focus_on_click);
+
void nsgtk_window_set_opacity(GtkWindow *window, gdouble opacity);
void nsgtk_scrolled_window_add_with_viewport(GtkScrolledWindow *window, GtkWidget *child);
@@ -268,6 +284,15 @@ GtkWidget *nsgtk_image_menu_item_new_with_mnemonic(const gchar *label);
*/
void nsgtk_image_menu_item_set_image(GtkWidget *image_menu_item, GtkWidget *image);
+/**
+ * Displays menu and makes it available for selection
+ *
+ * Compatability interface for gtk_menu_popup deprecated in GTK 3.22.
+ *
+ * \param image_menu_item The image menu entry item.
+ * \param trigger_event the GdkEvent that initiated this request or NULL if it's the current event.
+ */
+void nsgtk_menu_popup_at_pointer(GtkMenu *menu, const GdkEvent *trigger_event);
/**
* Parses a resource file containing a GtkBuilder UI definition and